fix: ensure Lua scripts are loaded before pipeline EVALSHA calls

Pipeline mode only sends EVALSHA (no automatic fallback to EVAL).
If Redis restarts and script cache is lost, all pipeline Lua calls
silently fail with NOSCRIPT. Add ensureScriptLoaded() to pre-load
scripts before pipeline execution.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
erioandClaude Opus 4.6 committed 2026-03-07 12:34:36 +08:00
1 parent 87e0a0f299
commit 7d276bc91d
2 files changed
+15 -14

No files matched your search

@@ -8,7 +8,6 @@ import (
"encoding/json"
"errors"
"fmt"
"log/slog"
"net/http"
"strconv"
"strings"
@@ -370,19 +369,7 @@ func (h *AccountHandler) List(c *gin.Context) {
}
}
if len(accountGroups) > 0 {
var affinityErr error
affinityClients, affinityErr = h.gatewayCache.GetAccountAffinityClientsBatch(c.Request.Context(), accountGroups, service.ClientAffinityTTL)
if affinityErr != nil {
slog.Error("GetAccountAffinityClientsBatch failed",
"error", affinityErr,
"account_count", len(accountGroups),
)
} else {
slog.Info("GetAccountAffinityClientsBatch success",
"account_count", len(accountGroups),
"result_count", len(affinityClients),
)
}
affinityClients, _ = h.gatewayCache.GetAccountAffinityClientsBatch(c.Request.Context(), accountGroups, service.ClientAffinityTTL)
}
}