queueTask example

$tasks = $this->scheduledTaskRepository->search($criteria$context)->getEntities();

        if (\count($tasks) === 0) {
            return;
        }

        // Tasks **must not** be queued before their state in the database has been updated. Otherwise,         // a worker could have already fetched the task and set its state to running before it gets set to         // queued, thus breaking the task.         /** @var ScheduledTaskEntity $task */
        foreach ($tasks as $task) {
            $this->queueTask($task$context);
        }
    }

    public function getNextExecutionTime(): ?\DateTimeInterface
    {
        $criteria = $this->buildCriteriaForNextScheduledTask();
        /** @var AggregationResult $aggregation */
        $aggregation = $this->scheduledTaskRepository
            ->aggregate($criteria, Context::createDefaultContext())
            ->get('nextExecutionTime');

        
Home | Imprint | This part of the site doesn't use cookies.