AlgoliaSearch\Index::waitTask PHP Method

waitTask() public method

All server task are asynchronous and you can check with this method that the task is published.
public waitTask ( string $taskID, integer $timeBeforeRetry = 100 ) : mixed
$taskID string the id of the task returned by server
$timeBeforeRetry integer the time in milliseconds before retry (default = 100ms)
return mixed
    public function waitTask($taskID, $timeBeforeRetry = 100)
    {
        while (true) {
            $res = $this->getTaskStatus($taskID);
            if ($res['status'] === 'published') {
                return $res;
            }
            usleep($timeBeforeRetry * 1000);
        }
    }