小优化
This commit is contained in:
parent
3f299e5a84
commit
43754377e8
|
@ -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)
|
v.v, ok = fn(a)
|
||||||
times := v.counter()
|
times := v.counter()
|
||||||
if ok || times == tryTimes {
|
if ok || times >= tryTimes {
|
||||||
v.ok = true
|
v.ok = true
|
||||||
vv.Val.Store(v)
|
vv.Val.Store(v)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user