Skip to content

Commit a4146ff

Browse files
committed
fix closed for internal writer
1 parent 1b95a97 commit a4146ff

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

ydb/_topic_writer/topic_writer_asyncio.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ async def wait_init(self) -> PublicWriterInitInfo:
157157

158158

159159
class WriterAsyncIOReconnector:
160+
_closed: bool
160161
_credentials: Union[ydb.Credentials, None]
161162
_driver: ydb.aio.Driver
162163
_update_token_interval: int
@@ -174,6 +175,7 @@ class WriterAsyncIOReconnector:
174175
_background_tasks: List[asyncio.Task]
175176

176177
def __init__(self, driver: SupportedDriverType, settings: WriterSettings):
178+
self._closed = False
177179
self._driver = driver
178180
self._credentials = driver._credentials
179181
self._init_message = settings.create_init_request()
@@ -191,7 +193,11 @@ def __init__(self, driver: SupportedDriverType, settings: WriterSettings):
191193
]
192194

193195
async def close(self):
194-
self._check_stop()
196+
if self._closed:
197+
return
198+
199+
self._closed = True
200+
195201
self._stop(TopicWriterStopped())
196202

197203
background_tasks = self._background_tasks

0 commit comments

Comments
 (0)