Skip to content

Commit 07aefb8

Browse files
author
Ask Solem
committed
backend.process_cleanup now called *after* execution
1 parent 1e45852 commit 07aefb8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

celery/worker/job.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,12 @@ def execute_safe(self, *args, **kwargs):
9494
def execute(self):
9595
"""Execute, trace and store the result of the task."""
9696
self.loader.on_task_init(self.task_id, self.task)
97-
self.task.backend.process_cleanup()
9897
if self.task.track_started:
9998
self.task.backend.mark_as_started(self.task_id)
100-
return super(WorkerTaskTrace, self).execute()
99+
try:
100+
return super(WorkerTaskTrace, self).execute()
101+
finally:
102+
self.task.backend.process_cleanup()
101103

102104
def handle_success(self, retval, *args):
103105
"""Handle successful execution."""

0 commit comments

Comments
 (0)