fix(httpapi): detect ws client disconnect via CloseRead to prevent subscriber leak
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MMHQTtnQtQqL8muAXHr9kd
This commit is contained in:
@@ -45,6 +45,13 @@ func (h *Hub) Unsubscribe(taskID, id int64) {
|
||||
}
|
||||
}
|
||||
|
||||
// SubscriberCount returns the number of active subscribers for a task (for tests/metrics).
|
||||
func (h *Hub) SubscriberCount(taskID int64) int {
|
||||
h.mu.Lock()
|
||||
defer h.mu.Unlock()
|
||||
return len(h.subs[taskID])
|
||||
}
|
||||
|
||||
func (h *Hub) Publish(ev Event) {
|
||||
h.mu.Lock()
|
||||
defer h.mu.Unlock()
|
||||
|
||||
Reference in New Issue
Block a user