Pimcore Maintenance // ScheduledTasksTask never get executed // Pimcore 11

36 Views Asked by At

I have a Pimcore 11 Project.

I want to schedule Page publishing. I set the schedule in the Pimcore UI and it shows up in the database.

However the task never gets executed. I have the cronjob set up properly, but even when i run bin/console pimcore:maintenance directly nothing happens.

I put a die() in the execute method of vendor/pimcore/pimcore/lib/Maintenance/Tasks/ScheduledTasksTask.php and it seems it never gets executed.

Did i forgot something?

1

There are 1 best solutions below

0
Eugene Kaurov On

It is not obvious, but scheduled tasks running is split in 2 processes:

  • scheduling to the queue
  • executing unique tasks from the queue in configured timeframe (after TTL expired)

It means, that there are huge amounts of edge cases why your task is not executing, e.g. TTL too big, or task is not registered

Usually this is enough:

bin/console pimcore:maintenance --force --job=some_task_name -vvv --async
bin/console messenger:consume pimcore_core pimcore_maintenance --time-limit=300

Remember to change 'some_task_name' to real one.

In crucial cases, you can temporarily configure __construct() method of your scheduled task to execute the task. It will allow testing. Remember to delete if before to commit.