Esempio n. 1
0
 public function inspect()
 {
     $inspectionDto = new InspectionDto();
     $inspectionMessage = '';
     if ($this->createdTasksBeforeHandling !== $this->correctlyExecuted + count($this->executedWithError)) {
         $this->allTasksComplete = false;
         $inspectionMessage .= "Not all tasks complete: " . " created (before handling): " . $this->createdTasksBeforeHandling . " correctlyExecuted: " . serialize($this->getCorrectlyExecuted()) . " executedWithError: " . serialize($this->getExecutedWithError()) . $this->loggerPostfix;
     }
     $this->logger->notice("CreatedTasks before handling: " . serialize($this->createdTasksBeforeHandling));
     $this->logger->notice("CreatedTasks after handling: " . serialize($this->createdTasksNumber));
     $this->logger->notice("CorrectlyExecuted: " . serialize($this->getCorrectlyExecuted()));
     $this->logger->notice("Executed with error: " . serialize($this->executedWithError));
     if (!empty($this->executedWithError)) {
         switch ($this->attentionMethod) {
             case InspectorConstants::LOG:
                 $this->makeAttentionLog($inspectionMessage);
                 break;
             case InspectorConstants::MAIL:
                 $this->sendAttentionMail($inspectionMessage);
                 break;
             default:
                 $this->makeAttentionLog($inspectionMessage);
                 //$this->sendAttentionMail($inspectionMessage);
         }
     }
     $inspectionDto->setInspectionMessage($inspectionMessage);
     return $inspectionDto;
 }
Esempio n. 2
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;
 }