Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add ability to set a custom Celery queue for async webhook (#11511)

Mika6ab8ad1723b5
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7ae96d3385..e34fdf1c19 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,6 +14,7 @@ All notable, unreleased changes to this project will be documented in this file.
### Other changes
- Move checkout metadata to separate model - #11264 by @jakubkuc
+- Add ability to set a custom Celery queue for async webhook - #11511 by @NyanKiyoshi
# 3.9.0
diff --git a/saleor/plugins/webhook/tasks.py b/saleor/plugins/webhook/tasks.py
index 59620d649f..52c3b59d7f 100644
--- a/saleor/plugins/webhook/tasks.py
+++ b/saleor/plugins/webhook/tasks.py
@@ -453,6 +453,7 @@ def send_webhook_using_scheme_method(
@app.task(
+ queue=settings.WEBHOOK_CELERY_QUEUE_NAME,
bind=True,
retry_backoff=10,
retry_kwargs={"max_retries": 5},
diff --git a/saleor/settings.py b/saleor/settings.py
index 86027fec33..b1b6a28698 100644
--- a/saleor/settings.py
+++ b/saleor/settings.py
@@ -794,6 +794,12 @@ PRODUCT_MAX_INDEXED_VARIANTS = 1000
executor.SubscriberExecutionContext = PatchedSubscriberExecutionContext # type: ignore
+# Optional queue names for Celery tasks.
+# Set None to route to the default queue, or a string value to use a separate one
+#
+# Queue name for update search vector
UPDATE_SEARCH_VECTOR_INDEX_QUEUE_NAME = os.environ.get(
"UPDATE_SEARCH_VECTOR_INDEX_QUEUE_NAME", None
)
+# Queue name for "async webhook" events
+WEBHOOK_CELERY_QUEUE_NAME = os.environ.get("WEBHOOK_CELERY_QUEUE_NAME", None)