Skip to content

Commit 4b2708e

Browse files
committed
Add countdown for indexing to start
1 parent 2b90da9 commit 4b2708e

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

celery_haystack/conf.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
class CeleryHaystack(AppConf):
88
#: The default alias to
99
DEFAULT_ALIAS = None
10+
#: The delay (in seconds) before task will be executed (Celery countdown)
11+
COUNTDOWN = 0
1012
#: The delay (in seconds) after which a failed index is retried
1113
RETRY_DELAY = 5 * 60
1214
#: The number of retries that are done

celery_haystack/utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,6 @@ def enqueue_task(action, instance):
3131
kwargs = {}
3232
if settings.CELERY_HAYSTACK_QUEUE:
3333
kwargs['queue'] = settings.CELERY_HAYSTACK_QUEUE
34-
get_update_task().apply_async([action, identifier], {}, **kwargs)
34+
if settings.CELERY_HAYSTACK_COUNTDOWN:
35+
kwargs['countdown'] = settings.CELERY_HAYSTACK_COUNTDOWN
36+
get_update_task().apply_async((action, identifier), {}, **kwargs)

0 commit comments

Comments
 (0)