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:
Jeffrey Paul 2025-07-28 19:07:30 +02:00
parent 62ed5e08aa
commit 0196251906
2 changed files with 7 additions and 5335 deletions

View File

@ -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)

5339
log.txt

File diff suppressed because it is too large Load Diff