Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
RB387 committed Dec 15, 2024
1 parent d712e3d commit 6a61863
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions arq/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,15 +488,19 @@ async def _read_stream_iteration(self) -> None:
if self.allow_pick_jobs:
if self.job_counter < self.max_jobs:
stream_msgs = await self._get_idle_tasks(count)
count = count - len(stream_msgs)
msgs_count = sum([len(msgs) for _, msgs in stream_msgs])

count -= msgs_count

if count > 0:
stream_msgs = await self.pool.xreadgroup(
groupname=self.consumer_group_name,
consumername=self.worker_id,
streams={self.queue_name + stream_key_suffix: '>'},
count=count,
block=int(max(self.stream_block_s * 1000, 1)),
stream_msgs.extend(
await self.pool.xreadgroup(
groupname=self.consumer_group_name,
consumername=self.worker_id,
streams={self.queue_name + stream_key_suffix: '>'},
count=count,
block=int(max(self.stream_block_s * 1000, 1)),
)
)

jobs = []
Expand Down

0 comments on commit 6a61863

Please sign in to comment.