add manual flag to cron

master
Aevann 2024-10-24 20:15:56 +03:00
parent da150f7a2a
commit 7b4b541c4c
2 changed files with 3 additions and 2 deletions

View File

@ -32,7 +32,7 @@ from files.cli import app, db_session, g
CRON_CACHE_TIMEOUT = 172800
def cron_fn(every_5m, every_1d, every_1mo, every_2mo):
def cron_fn(every_5m, every_1d, every_1mo, every_2mo, manual):
with app.app_context():
g.db = db_session()
g.v = None
@ -133,6 +133,7 @@ def cron_fn(every_5m, every_1d, every_1mo, every_2mo):
@click.option('--every-1d', is_flag=True, help='Call every 1 day.')
@click.option('--every-1mo', is_flag=True, help='Call every 1 month.')
@click.option('--every-2mo', is_flag=True, help='Call every 2 months.')
@click.option('--manual', is_flag=True, help='Call manually.')
def cron(**kwargs):
cron_fn(**kwargs)

View File

@ -60,4 +60,4 @@ if IS_LOCALHOST:
if "cron" not in argv and "load_chat" not in argv:
from files.helpers.cron import cron_fn
print('Starting cron tasks!', flush=True)
gevent.spawn(cron_fn, True, False, False, False)
gevent.spawn(cron_fn, True, False, False, False, False)