fix(android): timeline thumbnails converge during upload runs #1524
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/android-timeline-thumb-refresh"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Defect
While the Android app uploads/backups media, the Fotos timeline showed placeholder tiles (previewStatus == PENDING) with spinners that NEVER flipped to the real thumbnail when the server finished it; newly committed items appeared only after the whole run ended. Both required a manual pull-to-refresh.
Root cause — three stacked gaps (server emission verified healthy, untouched)
SSE transport:
ServerEventStreamran on a plainOkHttpClient()— default read timeout 10 s — against a server whose event stream sends no heartbeats (emitter closes only at 30 min). The idle socket was torn down every quiet 10 s; events emitted during the 1–60 s reconnect backoff (thumbnails_ready,timeline_visibility_changed) were lost. The web client (browser EventSource) has no such timeout — an Android-only regression. Verifiedthumbnails_readyemission is healthy server-side (DerivedAssetResultHandler→WorkerResultService→publishThumbnailsReadyAfterCommit, owner included in viewer set;WorkerResultThumbnailsReadyEventTestcovers it).PENDING cells had no self-healing:
ThumbnailCellrenders no image request whilepreviewStatus == pending, so the per-cell 6 s×10 retry loop never ran for them; a missed event pinned the spinner until manual refresh.Engine commits invisible mid-run:
TimelineViewModelrefreshed only on the active→terminalBackupWorkSnapshottransition — during a multi-minute run nothing refreshed, new items only appeared at run end.Fix (client-side only, additive)
ServerEventStream.streamingClient(): read + call timeouts disabled, connect/write bounded 15 s; pinned bySseTransportTimeoutTest(also guards the 10 s default that broke it).ThumbnailRetryScheduler.startPendingProbes(): bounded slow probe lane for pending cells (60 s × 10, negative attempt numbers, budget separate from the failed-load lane, torn down on status change/dispose/first load callback). Once armed, the cell fetches the thumbnail even while the status still reads pending.BackupEnginegains an additive outcome-onlyonBatchCommitted(sessionId)hook fired inside the NonCancellable durability epilogue (never on abort/empty run). No upload/commit protocol change;UploadSessionClientuntouched (the upload-error lane consumes the same outcomes; we add no changes there). Threaded viaAndroidSyncController→ container-scopedMutableSharedFlow→ factory →TimelineViewModel.backupCommitEvents, which setswindowRefreshRequestedthrough the existingscheduleTargetedRefreshworker (400 ms debounce; no second refresh path). Terminal-snapshot refresh kept as safety net.Tests
:core+:appunit suites green (post-rebase on latest main); app module compiled.[ISSUE-233]
f185cea8e94d5f1e1923