Skip to content

Commit

Permalink
Fix: stop accepting new process request when the batcher is stoped (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
hussein-awala authored Feb 23, 2024
1 parent b973c29 commit 0130b9c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions async_batcher/batcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ async def process(self, item: T) -> S:
Returns:
S: The result of processing the item.
"""
if self._should_stop:
raise RuntimeError("Batcher is stopped")
if self._current_task is None:
self._current_task = asyncio.get_running_loop().create_task(self.batch_run())
logging.debug(item)
Expand Down

0 comments on commit 0130b9c

Please sign in to comment.