Skip to content

Commit

Permalink
sleep before restarting consumer (#2722)
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderegg authored Jan 7, 2022
1 parent ecd71ec commit 5903c51
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ async def events_message_parser(app: web.Application, data: bytes) -> None:


APP_RABBITMQ_POOL_KEY = f"{__name__}.pool"
_RABBITMQ_INTERVAL_BEFORE_RESTARTING_CONSUMER_S = 2


async def setup_rabbitmq_consumer(app: web.Application) -> AsyncIterator[None]:
Expand Down Expand Up @@ -196,6 +197,10 @@ async def exchange_consumer(
"restarting..." if consumer_running else "stopping",
exc_info=True,
)
if consumer_running:
await asyncio.sleep(_RABBITMQ_INTERVAL_BEFORE_RESTARTING_CONSUMER_S)

# TODO

consumer_tasks = []
for exchange_name, message_parser, consumer_kwargs in [
Expand Down

0 comments on commit 5903c51

Please sign in to comment.