Skip to main content

Background Tasks

Some of the Saleor’s functionality depends on a task queue system to manage asynchronous and periodic tasks. We recommend using Redis as the message broker. For more information, please visit official Celery documentation.

Periodic tasks​

Saleor uses Celery Beat as a scheduler to trigger background tasks at regular intervals. The task scheduler is required for proper operation.

  1. Make sure the CELERY_BROKER_URL environment variable is set for all services and points to the task broker. Again, we recommend using Redis as a broker database.
set CELERY_BROKER_URL="<broker url>"

An example of the Redis broker url, running on localhost and port 6379, looks like: redis://localhost:6379/0.

  1. Using the same container image, deploy Celery Workers by overriding the default command with:
celery --app saleor.celeryconf:app worker -E --loglevel=info
  1. Deploy exactly one instance of Celery Beat by overriding the default command with:
celery --app saleor.celeryconf:app beat --scheduler saleor.schedulers.schedulers.DatabaseScheduler 

Task Schedule​

Below is a list of periodic tasks that Saleor runs, provided as a reference.

Tasks run in intervals:​

Tasks run at specific time:​