Skip to content

Commit

Permalink
Since Celery 4.2, Async results call their backend in their __del__ m…
Browse files Browse the repository at this point in the history
…ethod. This can cause callstacks should the backend be disabled before destruction. This is a useful function for disabling an async result and all it's cached children.
  • Loading branch information
MarcDelahousse committed Apr 12, 2019
1 parent 2c5026e commit 5af487b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions firexkit/result.py
Expand Up @@ -219,3 +219,10 @@ def get_results(result: AsyncResult, return_keys=(), return_keys_only=True, merg
return tuple([extracted_dict.get(key) for key in return_keys])
else:
return extracted_dict


def disable_async_result(result: AsyncResult):
children = result.children or []
for child in children:
disable_async_result(child)
result.backend = None

0 comments on commit 5af487b

Please sign in to comment.