Fixed issue where scheduler was not initialized after setup wizard. Also fixed issue where global synchronization wasn't updated when the admin settings are changed.

This commit is contained in:
2018-12-31 13:53:25 +02:00
parent 070755f119
commit f879583637
4 changed files with 26 additions and 3 deletions

View File

@ -148,10 +148,22 @@ def synchronize_subscription(subscription: Subscription):
__lock.release()
__global_sync_job = None
def schedule_synchronize_global():
global __global_sync_job
trigger = CronTrigger.from_crontab(appconfig.sync_schedule)
job = scheduler.add_job(synchronize, trigger, max_instances=1, coalesce=True)
log.info('Scheduled synchronize job job=%s', job.id)
if __global_sync_job is None:
trigger = CronTrigger.from_crontab(appconfig.sync_schedule)
__global_sync_job = scheduler.add_job(synchronize, trigger, max_instances=1, coalesce=True)
else:
__global_sync_job.reschedule(trigger, max_instances=1, coalesce=True)
log.info('Scheduled synchronize job job=%s', __global_sync_job.id)
def schedule_synchronize_now():