Skip to content

add SchedulerPauseModel: persist pauses across restarts (#2360, phase 1) - #2532

Open
ebuzerdrmz44 wants to merge 1 commit into
borgbase:masterfrom
ebuzerdrmz44:refactor/scheduler-pause-persistence
Open

add SchedulerPauseModel: persist pauses across restarts (#2360, phase 1)#2532
ebuzerdrmz44 wants to merge 1 commit into
borgbase:masterfrom
ebuzerdrmz44:refactor/scheduler-pause-persistence

Conversation

@ebuzerdrmz44

Copy link
Copy Markdown
Contributor

Description

When a scheduled backup can't run (repo busy, network gone), the scheduler pauses that profile for up to an hour instead of retrying in a loop. Two problems with that. The schedule page reads "None scheduled" the whole time, so the user has no idea why backups stopped or when they resume. And the pause only lives in memory, so restarting Vorta throws the backoff away and goes straight back at whatever was broken. #2360 lists the second one under the jobs store.

What's in it

  • SchedulerPauseModel: the profile FK as primary key plus paused_until, one row per profile.
  • _set_pause / _clear_pause / _restore_pauses(), the last dropping anything that expired while Vorta was closed
  • ScheduleStatusType.PAUSED and a "Paused until 14:32" label.

Independent of #2530, so it sits on master and the two can land in either order. No migration.

Completes Phase A of the renewed plan.

Calls I'd like you to check

  1. Own table, not a column on BackupProfileModel. profile_export.py serialises with model_to_dict, so a column would export a stale pause to whoever imports the profile.
  2. Own table, not a JobModel row. You asked for only skipped/interrupted/completed in the store, and a live pause is none of those. Cheap to change now, awkward after a release.
  3. The label ships here, not in Phase D. paused() had no production caller before this, so persisting the state alone would have bought nothing. Lifts back out if you'd rather it waited for the Jobs view.

Known gaps

  • A pause still isn't recorded as a skip. It's a fourth skip point _record_skip doesn't cover, and it needs both branches in one tree, so it goes in whichever lands second.
  • Nothing ends a pause early. unpause() only fires from a successful scheduled backup, and manual backups never connect scheduler.notify. Want a successful manual run to unpause, or an action next to the label?
  • While a remote repo's network is down, reload_all_timers clears the label back to "None scheduled" even though the pause is still in effect. It comes back on the next reload, and set_timer_for_profile gets restructured in the Phase B split anyway, so I left it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant