fix: discard reconnect channel to prevent memory leak

This commit is contained in:
2026-02-08 11:46:26 +07:00
parent 2200657ba7
commit b296d73367

View File

@@ -294,6 +294,11 @@ func (wsClient *SafeWebsocketClient) reconnectHandler() {
default: // prevent blocking if chan is full
}
}
if len(wsClient.reconnectChans) > 1 {
wsClient.reconnectChans = wsClient.reconnectChans[1:]
} else {
wsClient.reconnectChans = nil
}
}
case <-wsClient.ctx.Done():
log.Println("reconnect handler stopped due to client shutdown")