Commit a6f89b6a authored by Julian Rother's avatar Julian Rother
Browse files

Run tasks (more or less) immediately after they are scheduled

parent 1a8f2361
......@@ -24,13 +24,15 @@ def run_scheduler():
while True:
def sched_func(delay, priority=0, args=[], kargs={}):
def sched_func(delay, priority=0, firstdelay=None, args=[], kargs={}):
if firstdelay == None:
firstdelay = random.randint(1, 120)
def wrapper(func):
def sched_wrapper():
with app.test_request_context():
func(*args, *kargs)
scheduler.enter(delay, priority, sched_wrapper)
scheduler.enter(delay, priority, sched_wrapper)
scheduler.enter(firstdelay, priority, sched_wrapper)
return func
return wrapper
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment