Skip to content

Commit 8b7b334

Browse files
committed
Merge branch 'develop' of github.com:Gillingham/evething into develop
2 parents 2e7ed34 + 11df7be commit 8b7b334

3 files changed

Lines changed: 7 additions & 1 deletion

File tree

evething/local_settings.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ ONLY_NEW_APIKEYS = True
6666
# Allow new users to register
6767
ALLOW_REGISTRATION = False
6868

69+
# Default stagger APITask calls on startup
70+
STAGGER_APITASK_STARTUP = True
71+
6972
# Celery broker URL - http://docs.celeryproject.org/en/latest/getting-started/first-steps-with-celery.html#choosing-a-broker
7073
BROKER_URL = 'amqp://guest:guest@localhost:5672/'
7174

evething/settings.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,9 @@
170170
# without updating local_settings, it won't error
171171
ALLOW_REGISTRATION = False
172172

173+
# Default stagger APITask calls on startup
174+
STAGGER_APITASK_STARTUP = True
175+
173176
# load local settings
174177
from local_settings import *
175178
MANAGERS = ADMINS

thing/tasks/apitask.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def init(self, taskstate_id=None, apikey_id=None):
102102

103103
# Sleep for staggered worker startup
104104
global this_process
105-
if this_process is None:
105+
if this_process is None and settings.STAGGER_APITASK_STARTUP:
106106
this_process = int(current_process()._name.split('-')[1])
107107
sleep_for = (this_process - 1) * 2
108108
self._logger.warning('Worker #%d staggered startup: sleeping for %d seconds', this_process, sleep_for)

0 commit comments

Comments
 (0)