Example #1
0
 /**
  * Registers the eviction of items from the queue.
  */
 private function registerEvictionEvents()
 {
     $this->reactLoop->addPeriodicTimer(1 / $this->config->getEvictionTicksPerSec(), function () {
         if (($item = $this->getQueue()->evict(round(microtime(true) * 1000000))) !== null) {
             if ($this->isInLogLevel(Logger::DEBUG)) {
                 $this->logger->debug("[Eviction] Timeout detected for '{$item->getKey()}' at " . round($item->getPriority() / 1000000, 3));
             }
             $this->getZmqOutboundQueue()->send(ResponseMessage::fromQueueItemToString($item));
             $this->runtimeStatistics->incrementEvictedObjectCount();
         }
     });
 }