Backfill the flowing lanes' activity buffer on relay reconnect - #753
Merged
Merged
Conversation
"activity" was a pure pass-through with no relay-side cache, unlike snapshot/run-history/enclosure-timeline: a browser that reconnected (page refresh, resumed SSH tunnel) started from an empty buffer and saw nothing until new events happened, even though the whole point of the flowing window is "the last 15 minutes." The relay now buffers the last _ACTIVITY_BUFFER_SECONDS of events and replays them as one synthetic activity message on watcher connect, in the same shape page.html's handleActivity already knows how to consume. Verified against a real relay + fake producer + real browser: refreshing the page after events had already arrived still showed them, backfilled from the relay's buffer, across all ten flowing lanes.
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.
Summary
"activity"was a pure pass-through on the relay, unlikesnapshot/run_history/enclosure_timeline: a browser reconnecting (page refresh, resumed SSH tunnel) started from an empty client-side buffer and saw nothing until a new event happened, even though the flowing window is meant to show "the last 15 minutes."_ACTIVITY_BUFFER_SECONDS(15 min, mirroringpage.html'sFLOWING_WINDOW_MS) of individual events and replays them as one syntheticactivitymessage on/watchconnect, in the exact shapepage.html'shandleActivityalready consumes — no client-side change needed.relay._activity_bufferreset to the test harness, and 4 newtest_relay.pycases: broadcast, replay-on-late-connect, pruning of stale events, and malformed-payload handling.Test plan
STATUS_RELAY_TOKEN=x apps/api/.venv/bin/python3 infra/status-relay/test_relay.py— 16/16 pass