Skip to content

companion: reuse the stalest sync cursor when all slots are taken - #62

Merged
B0N3-GD merged 1 commit into
mainfrom
fix/sync-cursor-reuse
Oct 21, 2026
Merged

B0N3-GD merged 1 commit into
mainfrom
fix/sync-cursor-reuse

Conversation

@B0N3-GD

@B0N3-GD B0N3-GD commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

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: getNextFromHistoryForClient returned 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

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>
@B0N3-GD
B0N3-GD merged commit 949627f into main Oct 21, 2026
4 checks passed
@B0N3-GD
B0N3-GD deleted the fix/sync-cursor-reuse branch October 21, 2026 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant