feat(cloud): immediate sync on login + live Syncing status feedback#19
Merged
Conversation
After login the 'Last sync' time stayed blank for up to ~60s (login only enqueued; the sync loop is a 60s ticker) and the Syncing status enum was never set. - Add login_notify (tokio Notify) on CloudState; cloud_login notifies it so the sync loop runs an immediate cycle (mirrors poller force_poll). - Sync loop select!s on the 60s tick or the login signal. - Set status=Syncing while a snapshot/miners push is in flight; success flips to Connected. Login sets Connecting; an end-of-cycle guard settles any leftover Connecting/Syncing to Connected (auth/error preserved). Frontend already maps syncing -> pulsing dot, so no UI change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
After login, "Last sync" stayed blank for up to ~60s — login only enqueued a snapshot, and the sync loop is a 60s ticker. The
Syncingstatus enum existed but was never set, so the user got no feedback that anything was happening.Fix (
cloud/)login_notify(tokio::sync::Notify) toCloudState.cloud_loginnotifies it after enqueueing, and the sync loopselect!s on the 60s tick or this signal — so login triggers an immediate cycle (mirrors the poller'sforce_poll).status = Syncingwhile a snapshot/miners push is in flight insync.rs; success flips toConnected.cloud_loginsetsConnecting; an end-of-cycle guard settles any leftoverConnecting/Syncing→Connected(so a login with no data to push still resolves cleanly).AuthRequired/Errorstates are preserved.UI
No change needed —
CloudSyncPanel.tsxalready mapssyncing→ pulsing dot andconnecting→ amber.Verification
cargo check✅ ·npx tsc --noEmit✅