fix: strategyFn index out of range if proxies changed (#2330)

This commit is contained in:
vernesong 2025-10-26 10:10:36 +08:00 committed by GitHub
parent fb1ae21fb7
commit dcfe664a7d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -194,7 +194,7 @@ func strategyStickySessions(url string) strategyFn {
key := utils.MapHash(getKeyWithSrcAndDst(metadata)) key := utils.MapHash(getKeyWithSrcAndDst(metadata))
length := len(proxies) length := len(proxies)
idx, has := lruCache.Get(key) idx, has := lruCache.Get(key)
if !has { if !has || idx >= length {
idx = int(jumpHash(key+uint64(time.Now().UnixNano()), int32(length))) idx = int(jumpHash(key+uint64(time.Now().UnixNano()), int32(length)))
} }