Skip to content

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

Add customizable schedule frequency for update-search tasks (#14152)

Mikail63bb70e31e2b
diff --git a/CHANGELOG.md b/CHANGELOG.md
index deb34c173d..6eaa5da8b1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -87,6 +87,7 @@ All notable, unreleased changes to this project will be documented in this file.
- Fix thumbnail redirects sometimes failing with an unsafe redirect warning - #14023 by @patrys
- New environment variable `PUBLIC_URL` to define URL on which Saleor is hosted (e.g., https://api.example.com/). Takes precedence over `ENABLE_SSL` and `Shop.domain` for URL generation - #13841 by @przlada
- Add a new `updatedAt` field and a filter for product categories. - #13825 by @rafiwts
+- Made the triggering frequency of update-search Celery beat tasks customizable (settable using `BEAT_UPDATE_SEARCH_FREQUENCY`) - #14152 by @NyanKiyoshi
# 3.16.0
diff --git a/saleor/settings.py b/saleor/settings.py
index d99bfb6cfe..33f5369966 100644
--- a/saleor/settings.py
+++ b/saleor/settings.py
@@ -553,7 +553,10 @@ BEAT_EXPIRE_ORDERS_AFTER_TIMEDELTA = timedelta(
# Defines after how many seconds should the task triggered by the Celery beat
# entry 'update-products-search-vectors' expire if it wasn't picked up by a worker.
-BEAT_UPDATE_SEARCH_EXPIRE_AFTER_SEC = 20
+BEAT_UPDATE_SEARCH_SEC = parse(
+ os.environ.get("BEAT_UPDATE_SEARCH_FREQUENCY", "20 seconds")
+)
+BEAT_UPDATE_SEARCH_EXPIRE_AFTER_SEC = BEAT_UPDATE_SEARCH_SEC
# Defines the Celery beat scheduler entries.
#
@@ -604,12 +607,12 @@ CELERY_BEAT_SCHEDULE = {
},
"update-products-search-vectors": {
"task": "saleor.product.tasks.update_products_search_vector_task",
- "schedule": timedelta(seconds=20),
+ "schedule": timedelta(seconds=BEAT_UPDATE_SEARCH_SEC),
"options": {"expires": BEAT_UPDATE_SEARCH_EXPIRE_AFTER_SEC},
},
"update-gift-cards-search-vectors": {
"task": "saleor.giftcard.tasks.update_gift_cards_search_vector_task",
- "schedule": timedelta(seconds=20),
+ "schedule": timedelta(seconds=BEAT_UPDATE_SEARCH_SEC),
"options": {"expires": BEAT_UPDATE_SEARCH_EXPIRE_AFTER_SEC},
},
"expire-orders": {