R80: req secret for introspection, pool conn on panic

This commit is contained in:
2026-08-13 18:26:59 +01:00
parent 351aae866e
commit 893a7ea251
4 changed files with 108 additions and 3 deletions
+8 -3
View File
@@ -376,9 +376,14 @@ func (r *RedisBackend) executeWithRetry(ctx context.Context, operation func(*Red
}
}
// Execute the operation
err = operation(conn)
r.pool.Put(conn)
// Execute the operation, guaranteeing the borrowed connection is
// returned to the pool even if the operation panics (previously a
// panic here leaked the connection and desynced the pool counters;
// other pool call sites use defer for this).
func() {
defer func() { r.pool.Put(conn) }()
err = operation(conn)
}()
// Check context after operation - if canceled, don't bother retrying
if ctx.Err() != nil {