From 79c9bf5fe557cd2a70451a1a8709ca64c2b28500 Mon Sep 17 00:00:00 2001 From: Austin Morton Date: Sun, 12 May 2024 17:09:32 +0100 Subject: [PATCH] Fix unintended cancellation of fetcher task (#1007) * Fix unintented cancellation of fetcher task * Update aiokafka/consumer/fetcher.py Co-authored-by: Denis Otkidach --------- Co-authored-by: Denis Otkidach --- aiokafka/consumer/fetcher.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/aiokafka/consumer/fetcher.py b/aiokafka/consumer/fetcher.py index 131ad135..df59c925 100644 --- a/aiokafka/consumer/fetcher.py +++ b/aiokafka/consumer/fetcher.py @@ -512,7 +512,8 @@ def on_done(fut, self=self): # cancellation if not task.done(): task.cancel() - await task + with contextlib.suppress(asyncio.CancelledError): + await task self._pending_tasks.clear() self._records.clear()