mirror of
https://github.com/sartography/cr-connect-workflow.git
synced 2025-02-23 21:28:32 +00:00
#557 - scheduler recursion because each call to 'process_witing_tasks' would kick off an additional scheduler by settting up a new app_context.
This commit is contained in:
parent
412290f2ab
commit
06960644fa
@ -56,15 +56,18 @@ from crc.services.file_service import FileService
|
|||||||
from crc.services.workflow_service import WorkflowService
|
from crc.services.workflow_service import WorkflowService
|
||||||
connexion_app.add_api('api.yml', base_path='/v1.0')
|
connexion_app.add_api('api.yml', base_path='/v1.0')
|
||||||
|
|
||||||
# needed function to avoid circular import
|
|
||||||
|
|
||||||
|
# needed function to avoid circular import
|
||||||
def process_waiting_tasks():
|
def process_waiting_tasks():
|
||||||
with app.app_context():
|
with app.app_context():
|
||||||
WorkflowService.do_waiting()
|
WorkflowService.do_waiting()
|
||||||
|
|
||||||
scheduler.add_job(process_waiting_tasks,'interval',minutes=1)
|
|
||||||
scheduler.add_job(FileService.cleanup_file_data, 'interval', minutes=1440) # once a day
|
@app.before_first_request
|
||||||
scheduler.start()
|
def init_scheduler():
|
||||||
|
scheduler.add_job(process_waiting_tasks, 'interval', minutes=1)
|
||||||
|
scheduler.add_job(FileService.cleanup_file_data, 'interval', minutes=1440) # once a day
|
||||||
|
scheduler.start()
|
||||||
|
|
||||||
|
|
||||||
# Convert list of allowed origins to list of regexes
|
# Convert list of allowed origins to list of regexes
|
||||||
|
Loading…
x
Reference in New Issue
Block a user