Scalr\System\Zmq\Cron\Task\Scheduler::worker PHP Method

worker() public method

See also: Scalr\System\Zmq\Cron\TaskInterface::worker()
public worker ( $request )
    public function worker($request)
    {
        $task = new Scalr_SchedulerTask();
        $task->setLogger($this->getLogger());
        $task->loadById($request);
        $this->log("DEBUG", "Trying to execute task:%d", $task->id);
        $container = \Scalr::getContainer();
        $container->release('auditlogger');
        //Ajdusts both account & environment for the audit log
        $container->auditlogger->setAccountId($task->accountId)->setEnvironmentId($task->envId);
        if ($task->execute()) {
            $task->updateLastStartTime();
            $this->getLogger()->info("Task %s:%d successfully sent", $task->name, $task->id);
        } else {
            $this->log('DEBUG', "Failed to execute task:%d", $task->id);
        }
        return $request;
    }