Pending backups can preempt a backup that is already executing Backup scheduling must…
- User
Pending backups can preempt a backup that is already executing
Backup scheduling must not select a pending backup while another backup is already executing. When none is executing, select the oldest pending backup, using a deterministic tie-break for equal creation times.
Interface
Type: Function Name: IsExecuting Path: api/v1/backup_funcs.go Input: () Output: bool Description: Returns true if the backup has started or is running. Use this to determine whether a backup holds active resources and should not be preempted.
- Assistant
I'll locate the backup scheduling logic and the
IsExecutinghook so pending backups can't preempt an in-flight run. - Assistant
Implementing
IsExecuting()and updating backup scheduling so pending backups can't preempt executing ones, with oldest-first selection. - Assistant
Updating tests to cover
IsExecutingand the new scheduling behavior. - Assistant
Fixed backup scheduling so pending backups no longer preempt an executing backup.
Root cause
CanExecuteBackuptreatedBackupPhasePendingas “in progress” viaIsInProgress(), so a pending backup could be selected to run even when another backup was already executing.Changes in
api/v1/backup_funcs.go-
IsExecuting()— returnstrueonly forstartedandrunningphases (backups holding active resources). -
CanExecuteBackup()— usesIsExecuting()instead ofIsInProgress()when checking for an active backup, so pending backups wait while another backup executes. -
GetPendingBackupNames()— returns backups that are not done and not executing (includingBackupPhasePending), sorted by oldest creation time first, with name as a deterministic tie-break.
Scheduling behavior
- If any backup is executing → only that backup (or the first one alphabetically if multiple are executing) may run.
- If none are executing → only the oldest pending backup may run.
- Pending backups no longer preempt executing ones.
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.