Skip to content

Commit

Permalink
Use a short timeout when we want to exit early on empty queues
Browse files Browse the repository at this point in the history
  • Loading branch information
liZe committed Jan 14, 2021
1 parent fbdbc41 commit f75b21a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion azafea/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,11 @@ def run(self) -> None:
queues = tuple(self.config.queues.keys())
log.debug('{%s} Pulling from event queues: %s', self.name, queues)

# Use a short timeout when we want to exit early on empty queues
timeout = 0.1 if self.config.main.exit_on_empty_queues else 5

while self._continue:
result = self._redis.brpop(queues, timeout=5)
result = self._redis.brpop(queues, timeout=timeout)

if result is None:
if self.config.main.exit_on_empty_queues:
Expand Down

0 comments on commit f75b21a

Please sign in to comment.