Skip to content

fix: add DataRestoreConstraint to StorageSyncJob#734

Open
bearyjd wants to merge 1 commit intomollyim:mainfrom
bearyjd:fix/storage-sync-restore-constraint
Open

fix: add DataRestoreConstraint to StorageSyncJob#734
bearyjd wants to merge 1 commit intomollyim:mainfrom
bearyjd:fix/storage-sync-restore-constraint

Conversation

@bearyjd
Copy link
Copy Markdown

@bearyjd bearyjd commented Apr 21, 2026

Summary

  • Add DataRestoreConstraint to StorageSyncJob to prevent it from running during local backup restore

Problem

During local backup restore, StorageSyncJob can execute before the restore completes, attempting to sync with Signal's storage service while the database is still being populated. This causes the restore to fail or hang indefinitely.

Fix

Add .addConstraint(DataRestoreConstraint.KEY) to StorageSyncJob's Parameters.Builder. This follows the same pattern already used by RebuildMessageSearchIndexJob, which correctly blocks during restore.

When DataRestoreConstraint.isRestoringData is true (set by RestoreRepository at the start of restore), the constraint prevents StorageSyncJob from executing. Once restore completes and the flag is cleared, the job proceeds normally.

Changes

  • StorageSyncJob.kt: Added DataRestoreConstraint.KEY constraint and its import (2 lines)

Test plan

  • Perform a local backup restore — verify StorageSyncJob does not run until restore completes
  • Verify normal storage sync still works after app restart (constraint is not active outside restore)
  • Verify no regression in cloud backup restore flow

Fixes #733

StorageSyncJob can run during local backup restore, attempting to sync
with Signal servers before the database is ready. This causes restore
to fail or hang.

Add DataRestoreConstraint to prevent StorageSyncJob from executing
while a backup restore is in progress, matching the pattern already
used by RebuildMessageSearchIndexJob.

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

StorageSyncJob missing DataRestoreConstraint causes crash during v2 backup restore

1 participant