Repository navigation
fix(telemetry): preserve client sync status on heartbeat ping - #124
Open
markusbrand wants to merge 1 commit into
Open
markusbrand wants to merge 1 commit into
markusbrand wants to merge 1 commit into
Conversation
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.
Overview
Fixes a bug where heartbeat or presence pings that omit sync outcome (
last_sync_atandlast_sync_ok, such as web app logins/pings or periodic client presence pings) overwrite previously recorded sync status inclient_connectionswithNULL.Problem & Root Cause
In
backend/app/telemetry/service.py,upsert_client_pingused SQLite'sON CONFLICT DO UPDATEwith unconditional assignment:When
stmt.excluded.last_sync_atandstmt.excluded.last_sync_okare null (the default when pings do not report sync results), the existing valid sync status was completely erased by NULL, causing admin telemetry and client connection views to lose sync history.Solution
last_sync_atandlast_sync_okinfunc.coalesceinbackend/app/telemetry/service.py:last_sync_ok = False) are reported.test_client_ping_preserves_sync_statusinbackend/tests/test_web_features.py.preserve-client-ping-sync-status.