Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing loop name from asyncio.create_task #489

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
12 changes: 5 additions & 7 deletions ydb/_topic_reader/topic_reader_asyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ async def __aexit__(self, exc_type, exc_val, exc_tb):

def __del__(self):
if not self._closed:
self._loop.create_task(self.close(flush=False), name="close reader")
self._loop.create_task(self.close(flush=False))

async def wait_message(self):
"""
Expand Down Expand Up @@ -337,13 +337,11 @@ async def _start(self, stream: IGrpcWrapperAsyncIO, init_message: StreamReadMess

self._update_token_event.set()

self._background_tasks.add(asyncio.create_task(self._read_messages_loop(), name="read_messages_loop"))
self._background_tasks.add(asyncio.create_task(self._decode_batches_loop(), name="decode_batches"))
self._background_tasks.add(asyncio.create_task(self._read_messages_loop()))
self._background_tasks.add(asyncio.create_task(self._decode_batches_loop()))
if self._get_token_function:
self._background_tasks.add(asyncio.create_task(self._update_token_loop(), name="update_token_loop"))
self._background_tasks.add(
asyncio.create_task(self._handle_background_errors(), name="handle_background_errors")
)
self._background_tasks.add(asyncio.create_task(self._update_token_loop()))
self._background_tasks.add(asyncio.create_task(self._handle_background_errors()))

async def wait_error(self):
raise await self._first_error
Expand Down
10 changes: 5 additions & 5 deletions ydb/_topic_writer/topic_writer_asyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@ def __init__(self, driver: SupportedDriverType, settings: WriterSettings):
self._new_messages = asyncio.Queue()
self._stop_reason = self._loop.create_future()
self._background_tasks = [
asyncio.create_task(self._connection_loop(), name="connection_loop"),
asyncio.create_task(self._encode_loop(), name="encode_loop"),
asyncio.create_task(self._connection_loop()),
asyncio.create_task(self._encode_loop()),
]

self._state_changed = asyncio.Event()
Expand Down Expand Up @@ -366,8 +366,8 @@ async def _connection_loop(self):

self._stream_connected.set()

send_loop = asyncio.create_task(self._send_loop(stream_writer), name="writer send loop")
receive_loop = asyncio.create_task(self._read_loop(stream_writer), name="writer receive loop")
send_loop = asyncio.create_task(self._send_loop(stream_writer))
receive_loop = asyncio.create_task(self._read_loop(stream_writer))

tasks = [send_loop, receive_loop]
done, _ = await asyncio.wait([send_loop, receive_loop], return_when=asyncio.FIRST_COMPLETED)
Expand Down Expand Up @@ -653,7 +653,7 @@ async def _start(self, stream: IGrpcWrapperAsyncIO, init_message: StreamWriteMes

if self._update_token_interval is not None:
self._update_token_event.set()
self._update_token_task = asyncio.create_task(self._update_token_loop(), name="update_token_loop")
self._update_token_task = asyncio.create_task(self._update_token_loop())

@staticmethod
def _ensure_ok(message: WriterMessagesFromServerToClient):
Expand Down
Loading