// Work through stack of queues, re-adding to the stack when a delay is
// necessary.
while($item = array_shift($queues)){ [ 'queue' => $queue, 'worker' => $worker, 'process_from' => $process_from, ] = $item;
// Each queue will be processed immediately when it is reached for the
// first time, as zero > currentTime will never be true.
if($process_from > $this->time->getCurrentMicroTime()){ $this->usleep(round($process_from - $this->time->getCurrentMicroTime(), 3) * 1000000); }
try{ $this->processQueue($queue, $worker); } catch(SuspendQueueException $e){ // Return to this queue after processing other queues if the delay is
// within the threshold.
if($e->isDelayable()&&($e->getDelay() < $max_wait)){ $item['process_from'] = $this->time->getCurrentMicroTime() + $e->getDelay();
/**
* {@inheritdoc}
*/ publicfunctiongetRequestMicroTime(){ $request = $this->requestStack->getCurrentRequest(); if($request){ return$request->server->get('REQUEST_TIME_FLOAT'); } // If this is called prior to the request being pushed to the stack fallback
// to built-in globals (if available) or the system time.
return$_SERVER['REQUEST_TIME_FLOAT'] ?? $this->getCurrentMicroTime(); }