mirror of https://github.com/borgbase/vorta
Remove jobs if scheduler setting is changed. (#1105)
This commit is contained in:
parent
228e580def
commit
d8b61a0e33
|
@ -38,7 +38,7 @@ class VortaScheduler(QtCore.QObject):
|
|||
"""
|
||||
Set a timer for next scheduled backup run of this profile.
|
||||
|
||||
Does nothing if set to manual backups or no repo is assigned.
|
||||
Removes existing jobs if set to manual only or no repo is assigned.
|
||||
|
||||
Else will look for previous scheduled backups and catch up if
|
||||
schedule_make_up_missed is enabled.
|
||||
|
@ -47,19 +47,24 @@ class VortaScheduler(QtCore.QObject):
|
|||
next suitable backup time.
|
||||
"""
|
||||
profile = BackupProfileModel.get_or_none(id=profile_id)
|
||||
if profile is None \
|
||||
or profile.repo is None \
|
||||
or profile.schedule_mode == 'off':
|
||||
if profile is None: # profile doesn't exist any more.
|
||||
return
|
||||
|
||||
logger.info('Setting new timer for profile %s', profile_id)
|
||||
# First stop and remove any existing timer for this profile
|
||||
self.lock.acquire()
|
||||
|
||||
# Stop and remove any existing timer for this profile
|
||||
if profile_id in self.timers:
|
||||
self.timers[profile_id]['qtt'].stop()
|
||||
del self.timers[profile_id]
|
||||
|
||||
# If no repo is set or only manual backups, just return without
|
||||
# replacing the job we removed above.
|
||||
if profile.repo is None or profile.schedule_mode == 'off':
|
||||
logger.debug('Scheduler for profile %s is disabled.', profile_id)
|
||||
self.lock.release()
|
||||
return
|
||||
|
||||
logger.info('Setting timer for profile %s', profile_id)
|
||||
|
||||
last_run_log = EventLogModel.select().where(
|
||||
EventLogModel.subcommand == 'create',
|
||||
EventLogModel.category == 'scheduled',
|
||||
|
|
Loading…
Reference in New Issue