Programming Language PHP

Namespace Oro\Component\MessageQueue\Job

Class Job

Method/Function setLastActiveAt

Total Examples 1

1 code examples of PHP Oro\Component\MessageQueue\Job\Job::setLastActiveAt extracted from open source projects

Was this example useful?
0
                                                    private function updateRootJob(Job $rootJob): void
    {
        $rootJob->setLastActiveAt(new \DateTime());

        $statusAndProgressCalculator = $this->statusCalculatorResolver->getCalculatorForRootJob($rootJob);
        $rootJobStatus = $statusAndProgressCalculator->calculateRootJobStatus();
        $rootJob->setStatus($rootJobStatus);

        if ($this->jobStatusChecker->isJobStopped($rootJob)) {
            $rootJob->setStoppedAt(new \DateTime());
        }

        $progress = $statusAndProgressCalculator->calculateRootJobProgress();
        if ($rootJob->getJobProgress() !== $progress) {
            $rootJob->setJobProgress($progress);
        }

        $statusAndProgressCalculator->clean();

        if ($this->jobStatusChecker->isJobStopped($rootJob)) {
            $message = new Message(['jobId' => $rootJob->getId()], MessagePriority::HIGH);
            $this->messageProducer->send(RootJobStoppedTopic::getName(), $message);
        }
    }