Worker stopped due to time limit of x exceeded
Running messenger:consume workers with a time limit can be useful, but you should also not set it too low.
By. Jacob
Edited: 2022-11-11 02:00
10:09:14 INFO [messenger] Worker stopped due to time limit of 300s exceeded
[
"timeLimit" => 300
]
This happens when you run a messenger:consume worker with a time limit like --time-limit=1800.
You do not have to worry about messages not being handled properly, since the time limit parameter specifically makes sure that the currently processing message finishes before the worker is stopped.
You should use supervisor, or a similar tool, to handle your messenger:consume workers, because then you can make them automatically restart when stopped.
Running messenger:consume or scheduled-task:run from cron is not recommended, as it they will be harder to manage.
Shopware messenger:consume settings
Shopware uses the Symfony Messenger component, and Shopware 6 recommends PHP at least has 512MB available memory, so you should consider starting your workers with a minimum of 512MB, and perhaps even more, since your workers should not normally reach the memory limit. But it may be nice with some leverage, so running with 1024MB probably does no harm.
If you are experiencing problems running your workers, it can sometimes help to run an extra worker with the -vvv option in order to see potential errors live in a terminal:
sudo -u www-data bin/console messenger:consume --memory-limit=1024M --time-limit=1800 -vvv
Tell us what you think: