Пример #1
0
 /**
  * @return null
  */
 public function handleInspection()
 {
     if (!empty($this->tasksInspector->getCreatedTasks())) {
         $this->recursionAttempts++;
         $repeatedTasks = "Repeated tasks: " . serialize($this->tasksInspector->getCreatedTasks());
         if ($this->recursionAttempts < ClientConstants::MAX_RECURSION_CALL_TASKS) {
             $this->logger->warning("Client " . $this->moduleName . " start to init tasks repeatedly. | " . $repeatedTasks);
             sleep(ClientConstants::MAX_GET_TASK_ATTEMPTS + $this->additionalSleepTime);
             $this->initTasks($this->tasksInspector->getCreatedTasks());
         } else {
             $attentionMsg = "Client " . $this->moduleName . " exceeded max recursionCallTasks constant (" . ClientConstants::MAX_RECURSION_CALL_TASKS . ") and finished. | " . $repeatedTasks;
             $this->tasksInspector->sendAttentionMail($attentionMsg);
             $this->logger->warning($attentionMsg);
             $this->recursionCallFinished = true;
         }
     } else {
         $this->tasksInspector->sendAttentionMail("All good. Inspection message: " . $this->inspectionDto->getInspectionMessage());
     }
     if ($this->tasksInspector->isMustDie()) {
         die;
     }
     return null;
 }