> Documentation index: [Saleor](/llms.txt) · [This section](/developer/llms.txt)
> Source: https://docs.saleor.io/developer/running-saleor/task-queue

# 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](https://docs.celeryq.dev/en/stable/index.html).

<a id="periodic-tasks"></a>

## Periodic tasks

Saleor uses [Celery Beat](https://docs.celeryq.dev/en/stable/index.html) 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.

```shell
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`.

2.  Using the same container image, deploy Celery Workers by overriding the default command with:

```shell
celery --app saleor.celeryconf:app worker -E --loglevel=info
```

3.  Deploy exactly one instance of Celery Beat by overriding the default command with:

```shell
celery --app saleor.celeryconf:app beat --scheduler saleor.schedulers.schedulers.DatabaseScheduler 
```

<a id="task-schedule"></a>

### Task Schedule

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

<a id="tasks-run-in-intervals"></a>

#### Tasks run in intervals:

-   Deactivate preorder for variants: every 1 hour
-   Delete empty allocations: every 1 hour
-   Delete expired reservations: every 1 day
-   Delete outdated event data: every 1 day
-   [Expire orders](/developer/order/order-expiration.md): every 5 minutes
-   [Recalculate price for catalog promotions](/developer/discounts/promotions.md#catalogue-promotions): every 30 seconds
-   [Release funds for abandoned checkouts](/developer/checkout/lifecycle.md#releasing-funds-for-abandoned-checkouts): every 10 minutes
-   Remove apps marked as removed: every 3 hours
-   [Update search vectors](https://github.com/saleor/saleor/blob/main/CONTRIBUTING.md#searching): every 20 seconds
-   [Automatic checkout completion](/developer/payments/transactions.md#automatic-checkout-completion): every 1 minute

<a id="tasks-run-at-specific-time"></a>

#### Tasks run at specific time:

-   Deactivate expired gift cards: at 0:00 AM
-   [Delete expired checkouts](/developer/checkout/lifecycle.md#checkout-expiration-and-deletion): at 0:00 AM
-   [Delete expired orders](/developer/order/order-expiration.md): at 2:00 AM
-   Delete old exports files: once per day at 1:00 AM
-   Update stocks quantity allocated: once per day at 0:00 AM
-   [Promotion toggle](/developer/discounts/promotions.md): based on promotion's start date and end date
