Skip to content

Commit a857c5a

Browse files
author
Valeriya Popova
committed
close reader/writer by del without flush
1 parent 778229e commit a857c5a

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

ydb/_topic_reader/topic_reader_asyncio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ async def __aexit__(self, exc_type, exc_val, exc_tb):
7575

7676
def __del__(self):
7777
if not self._closed:
78-
self._loop.create_task(self.close(), name="close reader")
78+
self._loop.create_task(self.close(flush=False), name="close reader")
7979

8080
async def receive_batch(
8181
self,

ydb/_topic_reader/topic_reader_sync.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ async def create_reader():
5050
).result()
5151

5252
def __del__(self):
53-
self.close()
53+
self.close(flush=False)
5454

5555
def __enter__(self):
5656
return self
@@ -152,13 +152,13 @@ def async_commit_with_ack(
152152
self._async_reader.commit_with_ack(mess)
153153
)
154154

155-
def close(self, *, timeout: TimeoutType = None):
155+
def close(self, *, flush: bool = True, timeout: TimeoutType = None):
156156
if self._closed:
157157
return
158158

159159
self._closed = True
160160

161-
self._caller.safe_call_with_result(self._async_reader.close(), timeout)
161+
self._caller.safe_call_with_result(self._async_reader.close(flush), timeout)
162162

163163
def _check_closed(self):
164164
if self._closed:

ydb/_topic_writer/topic_writer_asyncio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def __del__(self):
6161
if self._closed or self._loop.is_closed():
6262
return
6363

64-
self._loop.call_soon(self.close)
64+
self._loop.call_soon(self.close, False)
6565

6666
async def close(self, *, flush: bool = True):
6767
if self._closed:

ydb/_topic_writer/topic_writer_sync.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ def __enter__(self):
5656
def __exit__(self, exc_type, exc_val, exc_tb):
5757
self.close()
5858

59+
def __del__(self):
60+
self.close(flush=False)
61+
5962
def close(self, *, flush: bool = True, timeout: TimeoutType = None):
6063
if self._closed:
6164
return

0 commit comments

Comments
 (0)