From 3a468a2a7f02bb64f731866916e2590bbfe96e6b Mon Sep 17 00:00:00 2001 From: Valeriya Popova Date: Wed, 7 Jun 2023 19:53:31 +0300 Subject: [PATCH] topic aio writer: fix __del__ --- ydb/_topic_writer/topic_writer_asyncio.py | 3 ++- ydb/_topic_writer/topic_writer_asyncio_test.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ydb/_topic_writer/topic_writer_asyncio.py b/ydb/_topic_writer/topic_writer_asyncio.py index d83187fc..dd969c7e 100644 --- a/ydb/_topic_writer/topic_writer_asyncio.py +++ b/ydb/_topic_writer/topic_writer_asyncio.py @@ -1,6 +1,7 @@ import asyncio import concurrent.futures import datetime +import functools import gzip import typing from collections import deque @@ -75,7 +76,7 @@ def __del__(self): if self._closed or self._loop.is_closed(): return - self._loop.call_soon(self.close, False) + self._loop.call_soon(functools.partial(self.close, flush=False)) async def close(self, *, flush: bool = True): if self._closed: diff --git a/ydb/_topic_writer/topic_writer_asyncio_test.py b/ydb/_topic_writer/topic_writer_asyncio_test.py index 77793243..8fee5cec 100644 --- a/ydb/_topic_writer/topic_writer_asyncio_test.py +++ b/ydb/_topic_writer/topic_writer_asyncio_test.py @@ -625,7 +625,7 @@ async def write_with_ack_future(self, messages: typing.List[InternalMessage]): self.messages_writted.set() return futures - async def close(self): + async def close(self, flush: bool): pass @pytest.fixture