-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add task queue section * Add links * Explain celery beat setup * Apply review changes
- Loading branch information
Showing
7 changed files
with
84 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
--- | ||
title: Task Queue | ||
sidebar_label: Task Queue | ||
--- | ||
|
||
Some of the Saleor’s functionality depends on a task queue system to manage asynchronous and periodic tasks. We recommend using Celery with Redis as the message broker. | ||
For more information, please visit [official Celery documentation](https://docs.celeryq.dev/en/stable/index.html). | ||
|
||
|
||
## Periodic tasks | ||
|
||
Celery Beat is a scheduler that triggers background tasks at regular intervals. | ||
Some of the Saleor's features can't be used without proper task scheduler setup. In order to start Celery Beat server: | ||
|
||
1. Specify `CELERY_BROKER_URL` environmental variable which points to task broker (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. Run Celery worker: | ||
|
||
```shell | ||
celery --app saleor.celeryconf:app worker -E --loglevel=info | ||
``` | ||
|
||
3. As a separate process run Celery Beat: | ||
|
||
```shell | ||
celery --app saleor.celeryconf:app beat --scheduler saleor.schedulers.schedulers.DatabaseScheduler | ||
``` | ||
|
||
Below is a list of Saleor features fired up by celery beat with default schedules: | ||
|
||
#### Tasks run in intervals: | ||
- Deactivate preorder for variants; 1 hour | ||
- Delete empty allocations; 1 hour | ||
- Delete expired reservations; 1 day | ||
- Delete outdated event data; 1 day | ||
- [Expire orders](developer/checkout/order-expiration.mdx); 5 minutes | ||
- [Recalculate price for catalog promotions](developer/discounts/promotions.mdx#catalogue-promotions); 30 seconds | ||
- [Release funds for abandoned checkouts](developer/checkout/lifecycle.mdx#releasing-funds-for-abandoned-checkouts); 10 minutes | ||
- Remove apps marked as removed; 3 hours | ||
- [Update search vectors](developer/community/contributing.mdx#searching); 20 seconds | ||
|
||
#### Tasks run at specific time: | ||
- Deactivate expired gift cards; at 0:00 AM | ||
- [Delete expired checkouts](developer/checkout/lifecycle.mdx#checkout-expiration-and-deletion); at 0:00 AM | ||
- [Delete expired orders](developer/checkout/order-expiration.mdx); at 2:00 AM base on | ||
- 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.mdx); based on promotion's start date and end date | ||
|
||
:::important | ||
It is important to understand that without proper task scheduler setup, the actions above will not be triggered. | ||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters