diff --git a/bot/src/modules/base/base_module.py b/bot/src/modules/base/base_module.py index ca6b6356..53ed3c71 100644 --- a/bot/src/modules/base/base_module.py +++ b/bot/src/modules/base/base_module.py @@ -62,8 +62,8 @@ class BaseModule(ModuleABC): services.add_transient(BaseReactionHandler) services.add_singleton(EventService) services.add_transient(UserWarningsService) - services.add_singleton(TaskABC, BirthdayWatcher) - services.add_singleton(TaskABC, ScheduledEventsWatcher) + services.add_transient(TaskABC, BirthdayWatcher) + services.add_transient(TaskABC, ScheduledEventsWatcher) # forms services.add_transient(BugReportForm) diff --git a/bot/src/modules/base/tasks/birthday_watcher.py b/bot/src/modules/base/tasks/birthday_watcher.py index 50015415..9e3f6f35 100644 --- a/bot/src/modules/base/tasks/birthday_watcher.py +++ b/bot/src/modules/base/tasks/birthday_watcher.py @@ -37,7 +37,7 @@ class BirthdayWatcher(TaskABC): if not self._is_maintenance(): self.watch.start() - @tasks.loop(time=datetime.time(hour=8, minute=0)) + @tasks.loop(time=datetime.time(hour=8, minute=0), reconnect=True) async def watch(self): self._logger.info(__name__, "Watching birthdays") try: diff --git a/bot/src/modules/base/tasks/scheduled_events_watcher.py b/bot/src/modules/base/tasks/scheduled_events_watcher.py index a9fad51d..0af433e5 100644 --- a/bot/src/modules/base/tasks/scheduled_events_watcher.py +++ b/bot/src/modules/base/tasks/scheduled_events_watcher.py @@ -37,7 +37,7 @@ class ScheduledEventsWatcher(TaskABC): if not self._is_maintenance(): self.watch.start() - @tasks.loop(hours=3) + @tasks.loop(hours=3, reconnect=True) async def watch(self): self._logger.info(__name__, "Watching scheduled events") try: diff --git a/bot/src/modules/special_offers/special_offers_module.py b/bot/src/modules/special_offers/special_offers_module.py index e64108b5..4609ffe2 100644 --- a/bot/src/modules/special_offers/special_offers_module.py +++ b/bot/src/modules/special_offers/special_offers_module.py @@ -17,6 +17,6 @@ class SteamSpecialOffersModule(ModuleABC): pass def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC): - services.add_singleton(TaskABC, SteamOfferWatcher) + services.add_transient(TaskABC, SteamOfferWatcher) # commands # events diff --git a/bot/src/modules/special_offers/steam_offer_watcher.py b/bot/src/modules/special_offers/steam_offer_watcher.py index d2af2b4d..0486573a 100644 --- a/bot/src/modules/special_offers/steam_offer_watcher.py +++ b/bot/src/modules/special_offers/steam_offer_watcher.py @@ -187,7 +187,7 @@ class SteamOfferWatcher(TaskABC): self._logger.trace(__name__, "Finished watching") return offers_for_notifications - @tasks.loop(hours=4) + @tasks.loop(hours=4, reconnect=True) async def watch(self): self._logger.info(__name__, "Watching steam special offers") try: