Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions ydb/_topic_writer/topic_writer_asyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,7 @@ async def _connection_loop(self):

tasks = [send_loop, receive_loop]
done, _ = await asyncio.wait([send_loop, receive_loop], return_when=asyncio.FIRST_COMPLETED)
await stream_writer.close()
done.pop().result()
done.pop().result() # need for raise exception - reason of stop task
except issues.Error as err:
err_info = check_retriable_error(err, retry_settings, attempt)
if not err_info.is_retriable:
Expand All @@ -380,12 +379,12 @@ async def _connection_loop(self):
self._stop(err)
return
finally:
if stream_writer:
await stream_writer.close()
for task in tasks:
task.cancel()
if tasks:
await asyncio.wait(tasks)
if stream_writer:
await stream_writer.close()

async def _encode_loop(self):
try:
Expand Down