perf: remove hot-path slog.Info from SSE event delivery (#2929)
The sendEvent client helper and server SSE handler both eagerly
fmt.Sprintf'd full event payloads on every event. During streaming
this caused hundreds of allocations/sec per client, adding multi-second
lag to the second connected instance.
Assisted-by: Crush:AWS Claude Opus 4.6
commitc433fd633a084c52f7efd0155454564135fa5330
authorTai Groot <tai@taigrr.com>
dateFri 15 May 2026, 17:12 (5 months ago)
parent391575d
internal/client/proto.go−1
@@ -179,7 +179,6 @@ func (c *Client) SubscribeEvents(ctx context.Context, id string) (<-chan any, er
179179}
180180
181181func sendEvent(ctx context.Context, evc chan any, ev any) {
182− slog.Info("Event received", "event", fmt.Sprintf("%T %+v", ev, ev))
183182 select {
184183 case evc <- ev:
185184 case <-ctx.Done():
internal/server/proto.go−1
@@ -218,7 +218,6 @@ func (c *controllerV1) handleGetWorkspaceEvents(w http.ResponseWriter, r *http.R
218218 if !ok {
219219 return
220220 }
221− c.server.logDebug(r, "Sending event", "event", fmt.Sprintf("%T %+v", ev.Payload, ev.Payload))
222221 wrapped := wrapEvent(ev.Payload)
223222 if wrapped == nil {
224223 continue