Repository navigation
companion: reuse the stalest sync cursor when all slots are taken - #62
Merged
Merged
Conversation
A node keeps a sync position for up to MAX_HISTORY_CLIENTS (8) apps. Once all were taken, a new client was never synced at all (getNextFromHistoryForClient returned 0 for it forever, and the cursors are persisted). The wadamesh web client gives every browser its own client id, so this now happens in practice. Reuse the cursor that is furthest behind instead; that client starts again from the oldest kept message. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
A node keeps a per-client sync position for up to 8 apps (MAX_HISTORY_CLIENTS). Once all 8 were used, a new client was never synced at all:
getNextFromHistoryForClientreturned 0 for it forever, and the cursors are persisted, so a reboot did not help.The wadamesh web client (app.wadamesh.com) now gives every browser its own client id, so a node that has seen a few browsers, phones and the touch UI reaches the limit in practice.
Fix: when all slots are taken, reuse the cursor that is furthest behind (the client least recently synced). That client starts again from the oldest message the node still keeps.
Built:
heltec_v4_companion_radio_usb_tcp. The same change is in wadamesh.🤖 Generated with Claude Code