forked from MarseyWorld/MarseyWorld
Fix cfa6c13ea: cron.py missing import.
parent
a2ca535ce3
commit
0fe1e57ecd
|
@ -10,8 +10,35 @@ import files.routes.static as route_static
|
||||||
|
|
||||||
from sys import stdout
|
from sys import stdout
|
||||||
import datetime
|
import datetime
|
||||||
|
import time
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
|
@app.cli.command('cron', help='Run scheduled tasks.')
|
||||||
|
@click.option('--every-5m', is_flag=True, help='Call every 5 minutes.')
|
||||||
|
@click.option('--every-1h', is_flag=True, help='Call every 1 hour.')
|
||||||
|
@click.option('--every-1d', is_flag=True, help='Call every 1 day.')
|
||||||
|
@click.option('--every-1mo', is_flag=True, help='Call every 1 month.')
|
||||||
|
def cron(every_5m, every_1h, every_1d, every_1mo):
|
||||||
|
g.db = db_session()
|
||||||
|
|
||||||
|
if every_5m:
|
||||||
|
lottery.check_if_end_lottery_task()
|
||||||
|
offsitementions.offsite_mentions_task()
|
||||||
|
|
||||||
|
if every_1h:
|
||||||
|
awards.award_timers_bots_task()
|
||||||
|
|
||||||
|
if every_1d:
|
||||||
|
stats.generate_charts_task(SITE)
|
||||||
|
route_static.stats_cached()
|
||||||
|
sub_inactive_purge_task()
|
||||||
|
|
||||||
|
if every_1mo:
|
||||||
|
give_monthly_marseybux_task()
|
||||||
|
|
||||||
|
g.db.commit()
|
||||||
|
g.db.close()
|
||||||
|
stdout.flush()
|
||||||
|
|
||||||
def sub_inactive_purge_task():
|
def sub_inactive_purge_task():
|
||||||
if not HOLE_INACTIVITY_DELETION:
|
if not HOLE_INACTIVITY_DELETION:
|
||||||
|
@ -77,30 +104,3 @@ def give_monthly_marseybux_task():
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
@app.cli.command('cron', help='Run scheduled tasks.')
|
|
||||||
@click.option('--every-5m', is_flag=True, help='Call every 5 minutes.')
|
|
||||||
@click.option('--every-1h', is_flag=True, help='Call every 1 hour.')
|
|
||||||
@click.option('--every-1d', is_flag=True, help='Call every 1 day.')
|
|
||||||
@click.option('--every-1mo', is_flag=True, help='Call every 1 month.')
|
|
||||||
def cron(every_5m, every_1h, every_1d, every_1mo):
|
|
||||||
g.db = db_session()
|
|
||||||
|
|
||||||
if every_5m:
|
|
||||||
lottery.check_if_end_lottery_task()
|
|
||||||
offsitementions.offsite_mentions_task()
|
|
||||||
|
|
||||||
if every_1h:
|
|
||||||
awards.award_timers_bots_task()
|
|
||||||
|
|
||||||
if every_1d:
|
|
||||||
stats.generate_charts_task(SITE)
|
|
||||||
route_static.stats_cached()
|
|
||||||
sub_inactive_purge_task()
|
|
||||||
|
|
||||||
if every_1mo:
|
|
||||||
give_monthly_marseybux_task()
|
|
||||||
|
|
||||||
g.db.commit()
|
|
||||||
g.db.close()
|
|
||||||
stdout.flush()
|
|
Loading…
Reference in New Issue