forked from rDrama/rDrama
put cron_fn in gevent to make it stop blocking
parent
8bd0429124
commit
d0c7524154
|
@ -27,6 +27,7 @@ from files.cli import app, db_session, g
|
||||||
CRON_CACHE_TIMEOUT = 172800
|
CRON_CACHE_TIMEOUT = 172800
|
||||||
|
|
||||||
def cron_fn(every_5m, every_1d):
|
def cron_fn(every_5m, every_1d):
|
||||||
|
with app.app_context():
|
||||||
g.db = db_session()
|
g.db = db_session()
|
||||||
g.v = None
|
g.v = None
|
||||||
|
|
||||||
|
|
|
@ -52,5 +52,4 @@ if FEATURES['PING_GROUPS']:
|
||||||
|
|
||||||
if IS_LOCALHOST:
|
if IS_LOCALHOST:
|
||||||
from files.helpers.cron import cron_fn
|
from files.helpers.cron import cron_fn
|
||||||
with app.app_context():
|
gevent.spawn(cron_fn, True, False)
|
||||||
cron_fn(True, False)
|
|
||||||
|
|
Loading…
Reference in New Issue