小优化

This commit is contained in:
xing 2023-04-25 21:05:10 +08:00
parent 3f299e5a84
commit 43754377e8

View File

@ -128,7 +128,7 @@ func GetAnyValBy[T, A any](namespace string, tryTimes int, a A, fn func(A) (T, b
}
v.v, ok = fn(a)
times := v.counter()
if ok || times == tryTimes {
if ok || times >= tryTimes {
v.ok = true
vv.Val.Store(v)
}