diff --git a/src/modules/stream_notifications/twitch/webhook.py b/src/modules/stream_notifications/twitch/webhook.py index b3df1f3..6e23e17 100644 --- a/src/modules/stream_notifications/twitch/webhook.py +++ b/src/modules/stream_notifications/twitch/webhook.py @@ -1,4 +1,4 @@ -from asyncio import sleep, gather +from asyncio import sleep, gather, wait, FIRST_COMPLETED, create_task import logging from typing import NoReturn, Literal @@ -180,6 +180,14 @@ class TwitchService: streamers = await StreamerConfigRepository.all() + await wait( + [ + create_task(cls._start_for_streamer(streamer)) + for streamer in streamers + ], + return_when=FIRST_COMPLETED + ) + await gather( *[cls._start_for_streamer(streamer) for streamer in streamers] )