Commit 506ff1ef authored by Denis Laxalde's avatar Denis Laxalde
Browse files

[hooks] Trigger CeleryTaskDeletedHook *before* entity deletion

In this hook, we attempt to read an attribute (task_id) of the deleted
entity. This will fail (cubicweb will return "unaccessible", but that's
another issue). Since the work is actually handled by an operation in
post-commit, using a before_entity_deletion not only resolves attribute
access but also makes sense.
parent 335318568970
......@@ -46,7 +46,7 @@ class CeleryTaskDeletedHook(Hook):
"""revoke task and flush task logs when a task is deleted"""
__regid__ = 'celerytask.celerytask_deleted'
__select__ = Hook.__select__ & is_instance('CeleryTask')
events = ('after_delete_entity',)
events = ('before_delete_entity',)
def __call__(self):
op = DeleteCeleryTaskOp.get_instance(self._cw)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment