diff --git a/internal/pubsub/broker.go b/internal/pubsub/broker.go index 5b2ae19d7639701b044ec38dfd2f63544c0fde01..bb02bfcce0fbe807890f81ace0d18f0c848bbb29 100644 --- a/internal/pubsub/broker.go +++ b/internal/pubsub/broker.go @@ -2,13 +2,15 @@ package pubsub import ( "context" + "log/slog" "sync" ) // bufferSize is the per-subscriber channel capacity for any broker // created via NewBroker. Publish is non-blocking, so a full buffer -// silently drops events; sized to cover a long streaming assistant -// turn (~one UpdatedEvent per token) even under TUI render stalls. +// drops events (with a warning log); sized to cover a long streaming +// assistant turn (~one UpdatedEvent per token) even under TUI render +// stalls. const bufferSize = 4096 type Broker[T any] struct { @@ -108,8 +110,9 @@ func (b *Broker[T]) Publish(t EventType, payload T) { select { case sub <- event: default: - // Channel is full, subscriber is slow - skip this event - // This prevents blocking the publisher + // Channel is full, subscriber is slow — skip this event. + // This prevents blocking the publisher. + slog.Warn("Pubsub buffer full; dropping event", "type", t) } } }