Skip to content

Commit 1a984d9

Browse files
committed
FORCE_EXECV is no longer enabled by default if using the eventloop (amqp/redis)
Also we set max_restarts to 100 in 1s when using the eventloop, that will work since we have the precision to do so then.
1 parent 0a4a092 commit 1a984d9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

celery/worker/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,13 @@ def __init__(self, w, autoscale=None, no_execv=False, **kwargs):
9191
if w.autoscale:
9292
w.max_concurrency, w.min_concurrency = w.autoscale
9393

94-
def create(self, w, semaphore=None):
94+
def create(self, w, semaphore=None, max_restarts=None):
9595
threaded = not w.use_eventloop
96-
forking_enable(w.no_execv or not w.force_execv)
96+
forking_enable(not threaded or (w.no_execv or not w.force_execv))
9797
procs = w.min_concurrency
9898
if not threaded:
9999
semaphore = w.semaphore = BoundedSemaphore(procs)
100+
max_restarts = 100
100101
pool = w.pool = self.instantiate(w.pool_cls, w.min_concurrency,
101102
initargs=(w.app, w.hostname),
102103
maxtasksperchild=w.max_tasks_per_child,
@@ -107,6 +108,7 @@ def create(self, w, semaphore=None):
107108
with_task_thread=threaded,
108109
with_result_thread=threaded,
109110
with_supervisor_thread=threaded,
111+
max_restarts=max_restarts,
110112
semaphore=semaphore)
111113
return pool
112114

0 commit comments

Comments
 (0)