diff --git a/src/vorta/scheduler.py b/src/vorta/scheduler.py index 5fb26f1cb..58d7e3770 100644 --- a/src/vorta/scheduler.py +++ b/src/vorta/scheduler.py @@ -38,7 +38,7 @@ def set_timer_for_profile(self, profile_id): """ 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 @@ def set_timer_for_profile(self, profile_id): 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',