ankitects / ankitects/anki

Periodic backups remain active after restoring a backup

Open
#5,573 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
30.5k
Forks
3.2k
PR merge metrics
PR metrics pending

Description

Restoring a backup tells the user that automatic syncing and backups are disabled until the profile is closed. The shutdown-backup path honors `restoring_backup`, but the periodic-backup timer does not.

Reproduction (use a disposable profile and backup):
1. Restore a backup and keep the recovered profile open.
2. Make a collection change, with periodic backup timing configured so that a backup becomes due.
3. Allow the periodic-backup timer to fire (it checks every five minutes).

Expected: automatic backups remain suppressed during the recovery session. A user-requested backup remains available.
Actual: the timer requests an automatic backup, which can create a new snapshot when the backend's time/change conditions are satisfied.

Source diagnosis: `_start_restore_backup()` sets `self.restoring_backup = True`, and it remains set until profile unload. `_unloadCollection()` and automatic sync already check it. `on_periodic_backup_timer()` calls `_create_backup_with_progress(user_initiated=False)` unconditionally.

A deterministic reproduction calls the timer method with `restoring_backup=True` and records the backup request; this avoids waiting or touching a real collection. The fix belongs in the timer so manual backups remain available.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.