fix(imessage): 🐛 fix empty-server initial-load detection
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
19e4dc440a
commit
638845e150
1 changed files with 7 additions and 2 deletions
|
|
@ -195,8 +195,13 @@ final class SyncManager: BaseSyncManager<SyncStats, SyncError> {
|
|||
// Initial-load path: server has nothing, stream a metadata-only batch
|
||||
// import (attachments without blob bytes). Subsequent cycles use the
|
||||
// standard incremental path with full attachment data.
|
||||
if isInitialLoad && stats.messageCount == 0 {
|
||||
log.info("Initial load detected - using batch sync")
|
||||
// Re-enter performInitialSync whenever the server is empty. The previous
|
||||
// gate flipped `isInitialLoad = false` after the first run regardless of
|
||||
// success — a partial-failure run would then route to the incremental
|
||||
// path on the next cycle even though the server still had zero messages,
|
||||
// making the missing data unrecoverable without a manual restart.
|
||||
if stats.messageCount == 0 {
|
||||
log.info("Server empty — entering initial-batch sync path")
|
||||
activityLog.info("First sync detected - using optimized batch endpoint")
|
||||
await performInitialSync()
|
||||
isInitialLoad = false
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue