Skip to content

Commit 5e24ac9

Browse files
committed
Fixing status check
1 parent 3755592 commit 5e24ac9

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

src/OxylabsApiClient.php

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -206,18 +206,10 @@ public function getPushPullResults(
206206
?string $type = null,
207207
): ?array {
208208
if ($check_status) {
209-
retry(
210-
$status_check_limit,
211-
function () use ($job_id): PushPullJob {
212-
$job = $this->getPushPullJob($job_id);
213-
if (! $job->isDone()) {
214-
throw new Exception("Job $job_id not completed");
215-
}
216-
217-
return $job;
218-
},
219-
$status_wait_seconds,
220-
);
209+
$attempts = 0;
210+
do {
211+
$job = $this->getPushPullJob($job_id);
212+
} while ($job->isPending() && $attempts++ < $status_check_limit && 0 === sleep($status_wait_seconds));
221213
}
222214

223215
return $this->getResult($job_id, $type);

0 commit comments

Comments
 (0)