mirror of
https://github.com/lukaszraczylo/gohoarder.git
synced 2026-11-26 06:37:07 +00:00
fix(websocket): start the event loop and throttle drop warnings
The app built the websocket server but never called Start, so nothing read the 256-slot broadcast channel. After the first 256 events every event was dropped with a warning, and dashboard clients blocked forever on the unbuffered register channel, leaking a goroutine per connection and never receiving events. Run now starts the loop with the other workers. Dropped events are counted in gohoarder_websocket_events_dropped_total and warned about at most once a minute.
This commit is contained in:
@@ -62,6 +62,14 @@ var (
|
||||
[]string{"reason"}, // ttl, lru, manual
|
||||
)
|
||||
|
||||
// WebSocketEventsDropped counts realtime events dropped because the broadcast channel was full.
|
||||
WebSocketEventsDropped = promauto.NewCounter(
|
||||
prometheus.CounterOpts{
|
||||
Name: "gohoarder_websocket_events_dropped_total",
|
||||
Help: "Realtime dashboard events dropped because the broadcast channel was full",
|
||||
},
|
||||
)
|
||||
|
||||
// Storage metrics
|
||||
StorageOperations = promauto.NewCounterVec(
|
||||
prometheus.CounterOpts{
|
||||
|
||||
Reference in New Issue
Block a user