src/Sherlock/common/tmp/RollingCurl/RollingCurl.php
public function getNextPendingRequests($limit = 1)
    {
        //Old method did a lot of array shuffling
        //New method simply maintains a pointer to the current position in the pending queue
        //and walks over the array
        //
        //Much faster, at the expense of not cleaning up memory.  Acceptable, if memory is a problem
        //a streaming interface should be used.

        //pendingRequestCount is incremented when docs are added, since that will happen less frequently than
        //being called here, saves on the slow-ish count()
        $count = $this->pendingRequestsCount;
        $limit = $this->pendingRequestsPosition + $limit;

        if ($limit > $count) {
            $limit = $count;
        }

        $ret = array();

        //for() is faster than foreach, while/each
        //$ret[] is faster than array_push()
        for ($i = $this->pendingRequestsPosition; $i < $limit; ++$i) {
            $ret[] = $this->pendingRequests[$i];
        }

        $this->pendingRequestsPosition = $limit;
        return $ret;

        //return array_splice($this->pendingRequests, 0, $limit);
    }
public function getNextPendingRequests($limit = 1)
    {
        //Old method did a lot of array shuffling
        //New method simply maintains a pointer to the current position in the pending queue
        //and walks over the array
        //
        //Much faster, at the expense of not cleaning up memory.  Acceptable, if memory is a problem
        //a streaming interface should be used.

        //pendingRequestCount is incremented when docs are added, since that will happen less frequently than
        //being called here, saves on the slow-ish count()
        $count = $this->pendingRequestsCount;
        $limit = $this->pendingRequestsPosition + $limit;

        if ($limit > $count) {
            $limit = $count;
        }

        $ret = array();

        //for() is faster than foreach, while/each
        //$ret[] is faster than array_push()
        for ($i = $this->pendingRequestsPosition; $i < $limit; ++$i) {
            $ret[] = $this->pendingRequests[$i];
        }

        $this->pendingRequestsPosition = $limit;
        return $ret;

        //return array_splice($this->pendingRequests, 0, $limit);
    }
Return the next $limit pending requests (may return nothing)

@param  int       $limit

@return Request[]