run cron in localhost too
parent
4ddc483bd2
commit
7f6a45a5b6
|
@ -26,10 +26,7 @@ from files.cli import app, db_session, g
|
||||||
|
|
||||||
CRON_CACHE_TIMEOUT = 172800
|
CRON_CACHE_TIMEOUT = 172800
|
||||||
|
|
||||||
@app.cli.command('cron', help='Run scheduled tasks.')
|
def cron_fn(every_5m, every_1d):
|
||||||
@click.option('--every-5m', is_flag=True, help='Call every 5 minutes.')
|
|
||||||
@click.option('--every-1d', is_flag=True, help='Call every 1 day.')
|
|
||||||
def cron(every_5m, every_1d):
|
|
||||||
g.db = db_session()
|
g.db = db_session()
|
||||||
g.v = None
|
g.v = None
|
||||||
|
|
||||||
|
@ -67,6 +64,12 @@ def cron(every_5m, every_1d):
|
||||||
print(f'Finished {kind} at {now}', flush=True)
|
print(f'Finished {kind} at {now}', flush=True)
|
||||||
stdout.flush()
|
stdout.flush()
|
||||||
|
|
||||||
|
@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.')
|
||||||
|
def cron(every_5m, every_1d):
|
||||||
|
cron_fn(every_5m, every_1d)
|
||||||
|
|
||||||
def _sub_inactive_purge_task():
|
def _sub_inactive_purge_task():
|
||||||
if not HOLE_INACTIVITY_DELETION:
|
if not HOLE_INACTIVITY_DELETION:
|
||||||
return False
|
return False
|
||||||
|
|
|
@ -49,3 +49,8 @@ if FEATURES['ASSET_SUBMISSIONS']:
|
||||||
from .push_notifs import *
|
from .push_notifs import *
|
||||||
if FEATURES['PING_GROUPS']:
|
if FEATURES['PING_GROUPS']:
|
||||||
from .groups import *
|
from .groups import *
|
||||||
|
|
||||||
|
if IS_LOCALHOST:
|
||||||
|
from files.helpers.cron import cron_fn
|
||||||
|
with app.app_context():
|
||||||
|
cron_fn(True, False)
|
||||||
|
|
Loading…
Reference in New Issue