Example #1
0
 /**
  * @return null
  */
 protected function declarePushMessaging()
 {
     $this->pullActionInfo->on(EventsConstants::MESSAGE, function ($pushDto) {
         $this->resolvePushMessage(unserialize($pushDto));
         $this->logger->debug("Receive push message {$pushDto}.");
     });
     $this->pullActionInfo->on(EventsConstants::ERROR, function ($error) {
         $this->logger->error(LoggingExceptions::getExceptionString($error));
     });
     return null;
 }
Example #2
0
 protected function logAndSendSigKill($pid, \Exception $e)
 {
     $this->logger->error(ExceptionsConstants::SEND_KILL_SIGNAL . "PID: " . $pid . " | " . LoggingExceptions::getExceptionString($e));
     $this->commandsManager->sendSig($pid, SIGKILL);
     return null;
 }
Example #3
0
 protected function tryGetPidInfo($key, $pid, $self = null)
 {
     $attempts = 0;
     $maxAttempts = 3;
     do {
         try {
             $pidInfo = $this->commandsManager->getPidLoadInfo($pid);
             if ($self) {
                 $this->pidsInfo[LmConstants::SELF_PID . "{$key}"] = $pidInfo;
             } else {
                 $this->pidsInfo[] = $pidInfo;
             }
             $attempts = $maxAttempts;
         } catch (\Exception $e) {
             $attempts++;
             $this->logger->error("Attempts to check info for PID {$pid}: {$attempts}");
             if ($attempts === $maxAttempts) {
                 $this->logger->error(LoggingExceptions::getExceptionString($e));
                 $this->finishedPids[] = $pid;
                 unset($this->pids[$key]);
             }
         }
     } while ($attempts < $maxAttempts);
     return null;
 }