handle on_failure task callback

This commit is contained in:
simon 2023-03-23 10:57:15 +07:00
parent 33b9a012d4
commit 2bc92c9095
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4

View File

@ -111,6 +111,9 @@ class BaseTask(Task):
def on_failure(self, exc, task_id, args, kwargs, einfo): def on_failure(self, exc, task_id, args, kwargs, einfo):
"""callback for task failure""" """callback for task failure"""
print(f"{task_id} Failed callback") print(f"{task_id} Failed callback")
message, key = self._build_message(level="error")
message.update({"messages": ["Task failed"]})
RedisArchivist().set_message(key, message, expire=20)
def on_success(self, retval, task_id, args, kwargs): def on_success(self, retval, task_id, args, kwargs):
"""callback task completed successfully""" """callback task completed successfully"""