forked from LionsAd/rolling-curl
-
Notifications
You must be signed in to change notification settings - Fork 52
Open
Description
Hi,
I just found that prunePendingRequestQueue does not work as it should, it always return empty list because of a bug in getNextPendingRequests. Please see this code:
private function getNextPendingRequests($limit = 1)
{
$requests = array();
while ($limit--) {
if (!isset($this->pendingRequests[$this->pendingRequestsPosition])) {
break;
}
$requests[] = $this->pendingRequests[$this->pendingRequestsPosition];
$this->pendingRequestsPosition++;
}
return $requests;
}If $limit is 0, the while loop will never run. I propose this patch to fix this bug:
- while ($limit--) {
+ $countPending = $limit <= 0 ? $this->countPending() : $limit;
+ while ($countPending--) {Metadata
Metadata
Assignees
Labels
No labels