Kohkimakimoto\Worker\Job\JobManager::addJobTimer PHP Method

addJobTimer() protected method

protected addJobTimer ( $job )
    protected function addJobTimer($job)
    {
        $job->updateNextRunTime();
        $secondsOfTimer = $job->secondsUntilNextRuntime();
        $self = $this;
        $this->eventLoop->addTimer($secondsOfTimer, function () use($self, $job) {
            $self->executeJob($job);
        });
        if ($this->output->isDebug()) {
            $this->output->writeln("[debug] Added new timer: '" . $job->getNextRunTime()->format('Y-m-d H:i:s') . "' (after " . $secondsOfTimer . " seconds) (job: " . $job->getName() . ").");
        }
    }