Skip to content

Commit 77d48a3

Browse files
authored
Merge pull request #153 fix raise exception for close after error
2 parents bece3a7 + 44edc47 commit 77d48a3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

ydb/_topic_writer/topic_writer_asyncio.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@ async def close(self):
197197
return
198198

199199
self._closed = True
200-
201200
self._stop(TopicWriterStopped())
202201

203202
background_tasks = self._background_tasks
@@ -207,6 +206,12 @@ async def close(self):
207206

208207
await asyncio.wait(self._background_tasks)
209208

209+
# if work was stopped before close by error - raise the error
210+
try:
211+
self._check_stop()
212+
except TopicWriterStopped:
213+
pass
214+
210215
async def wait_init(self) -> PublicWriterInitInfo:
211216
done, _ = await asyncio.wait(
212217
[self._init_info, self._stop_reason], return_when=asyncio.FIRST_COMPLETED

0 commit comments

Comments
 (0)