From 9eed685f45c8c23d75d441bcf48fe25a55d75920 Mon Sep 17 00:00:00 2001 From: Battlefield Duck Date: Tue, 8 Nov 2022 22:26:35 +0800 Subject: [PATCH] Fix 'Task is already launched and is not completed' issue --- discordgsm/main.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/discordgsm/main.py b/discordgsm/main.py index cbc77de..e023356 100644 --- a/discordgsm/main.py +++ b/discordgsm/main.py @@ -64,12 +64,13 @@ async def on_ready(): await sync_commands(whitelist_guilds) await tasks_fetch_messages() - tasks_query.start() + if not tasks_query.is_running(): + tasks_query.start() - if os.getenv('WEB_API_ENABLE', '').lower() == 'true': + if not cache_guilds.is_running() and os.getenv('WEB_API_ENABLE', '').lower() == 'true': cache_guilds.start() - if os.getenv('HEROKU_APP_NAME') is not None: + if not heroku_query.is_running() and os.getenv('HEROKU_APP_NAME') is not None: heroku_query.start()