예제 #1
0
 /**
  * Retry connecting to the transport
  */
 public function retryConnection()
 {
     $options = $this->reconnectOptions;
     if ($this->attemptRetry === false) {
         return;
     }
     if ($options['max_retries'] <= $this->retryAttempts) {
         return;
     }
     $this->retryAttempts++;
     if ($this->retryTimer >= $options['max_retry_delay']) {
         $this->retryTimer = $options['max_retry_delay'];
     } elseif ($this->retryTimer == 0) {
         $this->retryTimer = $options['initial_retry_delay'];
     } else {
         $this->retryTimer = $this->retryTimer * $options['retry_delay_growth'];
     }
     $this->loop->addTimer($this->retryTimer, function () {
         $this->transportProvider->startTransportProvider($this, $this->loop);
     });
 }
예제 #2
0
 /**
  * Registers a periodically triggered status event.
  */
 private function registerTimedEvents()
 {
     $this->reactLoop->addPeriodicTimer($this->config->getStatusLoopInterval(), function () {
         $memoryUsageMb = memory_get_usage(true) / 1024 / 1024;
         $this->runtimeStatistics->setMemoryUsageMb($memoryUsageMb);
         if ($memoryUsageMb > $this->config->getMemoryLimitMbWarn()) {
             $this->logger->warning("MemoryUsage:   {$memoryUsageMb} MB.");
         } else {
             if ($memoryUsageMb > $this->config->getMemoryLimitMbInfo()) {
                 $this->logger->info("MemoryUsage:   {$memoryUsageMb} MB.");
             }
         }
         $memoryPeakUsageMb = memory_get_peak_usage(true) / 1024 / 1024;
         $this->runtimeStatistics->setMemoryPeakUsageMb($memoryPeakUsageMb);
         if ($memoryPeakUsageMb > $this->config->getMemoryPeakLimitMbWarn()) {
             $this->logger->warning("MemoryPeakUsage " . memory_get_peak_usage(true) / 1024 / 1024 . " MB.");
         }
         $rateObjects = $this->runtimeStatistics->getAddedObjectRate($this->config->getStatusLoopInterval());
         $rateEvictions = $this->runtimeStatistics->getEvictionRate($this->config->getStatusLoopInterval());
         $this->logger->info("Added objects: {$this->runtimeStatistics->getAddedObjectCount()}, evictions: {$this->runtimeStatistics->getEvictedObjectCount()} ({$rateObjects} Obj/Sec, {$rateEvictions} Evi/Sec).");
         $this->runtimeStatistics->tick();
     });
 }
예제 #3
0
 /**
  *
  */
 public function run()
 {
     $this->reactLoop->run();
 }
예제 #4
0
 /**
  *
  */
 public function stop()
 {
     $this->loop->stop();
 }
예제 #5
0
파일: Client.php 프로젝트: Dualse/GitterBot
 /**
  * @return Client
  */
 public function run() : Client
 {
     $this->loop->run();
     return $this;
 }
예제 #6
0
 public function run()
 {
     $this->loop->run();
 }