mirror of
https://github.com/status-im/consul.git
synced 2025-02-16 15:47:21 +00:00
Fix lock and semaphore timeouts
This commit is contained in:
parent
28ffc75f64
commit
9043966efd
@ -181,11 +181,12 @@ WAIT:
|
|||||||
// Handle the one-shot mode.
|
// Handle the one-shot mode.
|
||||||
if l.opts.LockTryOnce && attempts > 0 {
|
if l.opts.LockTryOnce && attempts > 0 {
|
||||||
elapsed := time.Since(start)
|
elapsed := time.Since(start)
|
||||||
if elapsed > qOpts.WaitTime {
|
if elapsed > l.opts.LockWaitTime {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
qOpts.WaitTime -= elapsed
|
// Query wait time should not exceed the lock wait time
|
||||||
|
qOpts.WaitTime = l.opts.LockWaitTime - elapsed
|
||||||
}
|
}
|
||||||
attempts++
|
attempts++
|
||||||
|
|
||||||
|
@ -199,11 +199,12 @@ WAIT:
|
|||||||
// Handle the one-shot mode.
|
// Handle the one-shot mode.
|
||||||
if s.opts.SemaphoreTryOnce && attempts > 0 {
|
if s.opts.SemaphoreTryOnce && attempts > 0 {
|
||||||
elapsed := time.Since(start)
|
elapsed := time.Since(start)
|
||||||
if elapsed > qOpts.WaitTime {
|
if elapsed > s.opts.SemaphoreWaitTime {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
qOpts.WaitTime -= elapsed
|
// Query wait time should not exceed the semaphore wait time
|
||||||
|
qOpts.WaitTime = s.opts.SemaphoreWaitTime - elapsed
|
||||||
}
|
}
|
||||||
attempts++
|
attempts++
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user