Skip to content

Commit 3776869

Browse files
add exception handling
1 parent f3bb46c commit 3776869

File tree

1 file changed

+8
-0
lines changed
  • packages/celery-library/src/celery_library/backends

1 file changed

+8
-0
lines changed

packages/celery-library/src/celery_library/backends/redis.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,14 @@ async def consume_task_events(
194194
count=_CELERY_TASK_STREAM_COUNT,
195195
)
196196
except asyncio.CancelledError:
197+
_logger.debug("Task event consumption cancelled for task %s", task_id)
198+
break
199+
except Exception as exc: # pylint: disable=broad-except
200+
_logger.warning(
201+
"Redis error while consuming task events for task %s: %s. Stopping consumption.",
202+
task_id,
203+
exc,
204+
)
197205
break
198206

199207
if not messages:

0 commit comments

Comments
 (0)