From b029ae2c387a7fd329794cd0e6964348e62a40fc Mon Sep 17 00:00:00 2001 From: Aevann Date: Thu, 14 Sep 2023 20:21:46 +0300 Subject: [PATCH] only print "Cron tasks finished" when they're actually finished --- files/helpers/cron.py | 3 +++ files/routes/__init__.py | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/files/helpers/cron.py b/files/helpers/cron.py index 10b87cd66..a60dda84c 100644 --- a/files/helpers/cron.py +++ b/files/helpers/cron.py @@ -102,6 +102,9 @@ def cron_fn(every_5m, every_1d, every_fri_12, every_fri_23, every_sat_00, every_ del g.db stdout.flush() + if IS_LOCALHOST: + print('Cron tasks Finished!', flush=True) + @app.cli.command('cron', help='Run scheduled tasks.') @click.option('--every-5m', is_flag=True, help='Call every 5 minutes.') @click.option('--every-1d', is_flag=True, help='Call every 1 day.') diff --git a/files/routes/__init__.py b/files/routes/__init__.py index 61e86dae4..b4d95e2d2 100644 --- a/files/routes/__init__.py +++ b/files/routes/__init__.py @@ -57,4 +57,3 @@ if IS_LOCALHOST: from files.helpers.cron import cron_fn print('Starting cron tasks!', flush=True) gevent.spawn(cron_fn, True, False, False, False, False, False) - print('Cron tasks Finished!', flush=True)