api/MarkLogic/MLPHP/RESTAPI.php
protected function waitUntilSuccess($request, $secs, $limit)
    {
        sleep($secs);
        $limit--;
        try {
            $response = $this->client->send($request);
        } catch(\Exception $e) {
            if ($limit > 0) {
                $this->waitUntilSuccess($request, $secs, $limit);
            } else {
                throw new Exception('waitUntilSuccess() timed out');
            }
        }
        return;
    }
protected function waitUntilSuccess($request, $secs, $limit)
    {
        sleep($secs);
        $limit--;
        try {
            $response = $this->client->send($request);
        } catch(\Exception $e) {
            if ($limit > 0) {
                $this->waitUntilSuccess($request, $secs, $limit);
            } else {
                throw new Exception('waitUntilSuccess() timed out');
            }
        }
        return;
    }
Sleep until a request is successful.

@param RESTRequest $request The request to send.
@param int $time Time in secs to wait between requests.
@param int $limit Cycles to complete before timing out.