Fixed potential panic in error handler when Redis is down. (#31643)

This commit is contained in:
Victor Lyuboslavsky
2025-08-06 17:14:31 +02:00
committed by GitHub
parent 6feb13a09c
commit 96507ad1a5
2 changed files with 10 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
Fixed potential panic in error handler when Redis is down.
+9
View File
@@ -12,6 +12,7 @@ import (
"crypto/sha256"
"encoding/base64"
"encoding/json"
"errors"
"fmt"
"net/http"
"strconv"
@@ -208,6 +209,14 @@ func (h *Handler) storeError(ctx context.Context, err error) {
return
}
// Check if pool is nil to prevent panic
if h.pool == nil {
if h.testOnStore != nil {
h.testOnStore(errors.New("redis pool is nil"))
}
return
}
// not using a connection that follows redirections here
// in order to do pipeline commands
conn := h.pool.Get()