Skip to content

Commit

Permalink
fix: SmartProcessingQueue private method (#512)
Browse files Browse the repository at this point in the history
* fix: SmartProcessingQueue private method

* chore: `black .`

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
BobTheBuidler and github-actions[bot] authored Jan 6, 2025
1 parent 947a472 commit dca1450
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions a_sync/primitives/queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ class ProcessingQueue(_Queue[Tuple[P, "asyncio.Future[V]"]], Generic[P, V]):
_closed: bool = False
"""Indicates whether the queue is closed."""

__slots__ = "func", "num_workers", "_worker_coro"
__slots__ = "func", "num_workers"

def __init__(
self,
Expand Down Expand Up @@ -328,12 +328,12 @@ def __init__(
self._no_futs = not return_data
"""Indicates whether tasks will return data via futures."""

@wraps(func)
async def _worker_coro() -> NoReturn:
"""Worker coroutine for processing tasks."""
return await self.__worker_coro()
# @wraps(func)
# async def _worker_coro() -> NoReturn:
# """Worker coroutine for processing tasks."""
# return await self._worker_coro()

self._worker_coro = _worker_coro
# self._worker_coro = wraps(func)(self._worker_coro)

# NOTE: asyncio defines both this and __str__
def __repr__(self) -> str:
Expand Down Expand Up @@ -494,7 +494,7 @@ def _workers(self) -> "asyncio.Task[NoReturn]":
return task

@log_broken
async def __worker_coro(self) -> NoReturn:
async def _worker_coro(self) -> NoReturn:
"""
The coroutine executed by worker tasks to process the queue.
"""
Expand Down Expand Up @@ -899,7 +899,7 @@ def _get(self):
return args, kwargs, fut()

@log_broken
async def __worker_coro(self) -> NoReturn:
async def _worker_coro(self) -> NoReturn:
"""
Worker coroutine responsible for processing tasks in the queue.
Expand All @@ -909,7 +909,7 @@ async def __worker_coro(self) -> NoReturn:
Any: Exceptions raised during task processing are logged.
Example:
>>> await queue.__worker_coro()
>>> await queue._worker_coro()
"""
get_next_job = self.get
func = self.func
Expand Down

0 comments on commit dca1450

Please sign in to comment.