8ae23164bb15179603d9c41bcaa14256bff65ebd
handleSSE mixed connection registration, backlog catch-up, and live broadcast relay into one function with three nested closures -- gocognit flagged it at 52 against a limit of 30. Extracted each concern into its own top-level piece: sseSince (resume-point resolution), registerSSEConn (subscribe/unsubscribe), and a new sseStream type carrying the per-connection state (send, catchUp, sendPage, drain) that the closures used to capture implicitly. Behavior is unchanged -- catchUp/sendPage's page-boundary and target-reached logic is the same control flow the original closure had, just named and independently testable. handleSSE itself is now a straight-line sequence of calls. Added direct unit tests against sendPage/catchUp for the boundary cases a full HTTP round-trip test doesn't exercise: a target reached mid-page vs. at a page boundary, a target of zero (drain everything), a write failure stopping the page immediately, and backlog spanning more than one EventsSince fetch.
Description
Archie connects events from your systems to agents that can investigate, reason, and act.
Define what an event means, map its data into a workflow, and give that workflow an agent equipped for the job: its own execution environment, tools, and identity.
https://archie.catlow.cloud
133 MiB
0 Stars
1 Watchers
0 Forks
Releases
11
Archie v1.62.0
Latest
Languages
Go
76.7%
Vue
13.1%
TypeScript
7.8%
JavaScript
1.2%
Shell
0.6%
Other
0.4%