Fix race condition crash in timeout middleware
- Remove duplicate http.Error call when context times out - The timeout middleware already handles writing the response - Prevents "concurrent write to websocket connection" panic
This commit is contained in:
parent
62ed5e08aa
commit
0196251906
@ -248,8 +248,7 @@ func (s *Server) handleStats() http.HandlerFunc {
|
|||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
s.logger.Error("Database stats timeout")
|
s.logger.Error("Database stats timeout")
|
||||||
http.Error(w, "Database timeout", http.StatusRequestTimeout)
|
// Don't write response here - timeout middleware already handles it
|
||||||
|
|
||||||
return
|
return
|
||||||
case err := <-errChan:
|
case err := <-errChan:
|
||||||
s.logger.Error("Failed to get database stats", "error", err)
|
s.logger.Error("Failed to get database stats", "error", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user