Recurring tasks are handled via Scheduled Tasks. Scheduled tasks add tasks to the message queue at fixed intervals, which are then also processed asynchronously. For example, this includes generating an export for comparison portals or checking whether new updates are available.
In a standard installation of Shopware, message queue tasks are stored in the database and processed via the browser, provided you are logged into the Administration. This is a fast and straightforward method but is not recommended for production systems.
The functioning of the Admin Worker requires that the Administration is open for a more extended time; otherwise, tasks will not be processed. If many users are logged on to the Administration, this can lead to a high CPU load. It is advisable to disable the Admin Worker and run the processes server-side via the CLI. In this way, tasks are processed even if no one is logged into the Administration, and a high CPU load due to multiple users is also avoided. This approach is especially useful for larger stores.
As explained, the use of the Admin Worker is not recommended for production systems. The following section describes how to disable the Admin Worker and run the Message Queue / Scheduled Tasks server-side.
The following settings are made directly on the server. Since the possibilities of the server configuration depend on the hoster, we explain this here generally. If you have questions about the operation of the server configuration, the support of your hoster should be able to help.
# config/packages/shopware.yaml shopware: admin_worker: enable_admin_worker: false
For the Message Queue and the Scheduled Tasks to be executed now, the processes must be started via the CLI.
bin/console messenger:consume default --time-limit=60
bin/console scheduled-task:run --time-limit=60
We recommend the parameter time-limit=60 for the above commands to execute the command for a maximum of 60 seconds. Alternatively / additionally, you can define a memory limit instead of a time limit. This is possible with the parameter --memory-limit=512M. More information can be found in our developer doc.
It is important in this process that the commands are executed regularly so that the message queue is continuously processed. This can be achieved, for example, by creating a cron job or a service on the server. Contact your hoster for this.
Some hosters provide articles describing how to set up there in their knowledge areas.
At Profihost, you can find more information about the setup under https://wissen.profihost.com/wissen/artikel/shopware-6-worker-im-hintergrund-laufen-lassen/
Hetzner provides the information under
Creoline provides the Informationen under
Timme Hosting provides the Informationen under