Rollback naming

This commit is contained in:
Jahongir Qurbonov 2024-10-18 20:02:22 +05:00
parent e46606ed95
commit 9c344ed603

View File

@ -232,26 +232,26 @@ class Sender:
async def _step_until_receive(self, rx: Future[bytes]) -> bytes: async def _step_until_receive(self, rx: Future[bytes]) -> bytes:
while True: while True:
await self._step() await self.step()
if rx.done(): if rx.done():
return rx.result() return rx.result()
async def get_updates(self) -> list[Updates]: async def get_updates(self) -> list[Updates]:
await self._step() await self.step()
updates, self._updates = self._updates, [] updates, self._updates = self._updates, []
return updates return updates
async def _step(self) -> None: async def step(self) -> None:
ticket_number = self._step_counter ticket_number = self._step_counter
async with self._lock: async with self._lock:
if self._step_counter == ticket_number: if self._step_counter == ticket_number:
# We're the one to drive IO. # We're the one to drive IO.
self._step_counter += 1 self._step_counter += 1
await self._do_step() await self._step()
# else: # A different task drive IO. # else: # A different task drive IO.
async def _do_step(self) -> list[Updates]: async def _step(self) -> list[Updates]:
self._try_fill_write() self._try_fill_write()
recv_req = asyncio.create_task(self._request_event.wait()) recv_req = asyncio.create_task(self._request_event.wait())