mirror of https://github.com/status-im/consul.git
Update comments on avoiding proxycfg deadlock
This commit is contained in:
parent
6e443e5536
commit
ec5f75776b
|
@ -624,7 +624,7 @@ func (s *state) run() {
|
||||||
}
|
}
|
||||||
|
|
||||||
select {
|
select {
|
||||||
// try to send
|
// Try to send
|
||||||
case s.snapCh <- *snapCopy:
|
case s.snapCh <- *snapCopy:
|
||||||
s.logger.Trace("Delivered new snapshot to proxy config watchers")
|
s.logger.Trace("Delivered new snapshot to proxy config watchers")
|
||||||
|
|
||||||
|
@ -635,10 +635,12 @@ func (s *state) run() {
|
||||||
// this iteration
|
// this iteration
|
||||||
continue
|
continue
|
||||||
|
|
||||||
// avoid blocking if a snapshot is already buffered, but queue up a retry with a timer
|
// Avoid blocking if a snapshot is already buffered in snapCh as this can result in a deadlock.
|
||||||
|
// See PR #9689 for more details.
|
||||||
default:
|
default:
|
||||||
s.logger.Trace("Failed to deliver new snapshot to proxy config watchers")
|
s.logger.Trace("Failed to deliver new snapshot to proxy config watchers")
|
||||||
|
|
||||||
|
// Reset the timer to retry later. This is to ensure we attempt to redeliver the updated snapshot shortly.
|
||||||
if coalesceTimer == nil {
|
if coalesceTimer == nil {
|
||||||
coalesceTimer = time.AfterFunc(coalesceTimeout, func() {
|
coalesceTimer = time.AfterFunc(coalesceTimeout, func() {
|
||||||
sendCh <- struct{}{}
|
sendCh <- struct{}{}
|
||||||
|
|
Loading…
Reference in New Issue