mirror of https://github.com/hashicorp/consul
proxycfg: fix goroutine leak when service is re-registered (#14988)
Fixes a bug where we'd leak a goroutine in state.run when the given context was canceled while there was a pending update.kisunji/fix-golden
parent
3a60885259
commit
f8b4b41205
|
@ -317,7 +317,10 @@ func (s *state) run(ctx context.Context, snap *ConfigSnapshot) {
|
||||||
// This runs in another goroutine so we can't just do the send
|
// This runs in another goroutine so we can't just do the send
|
||||||
// directly here as access to snap is racy. Instead, signal the main
|
// directly here as access to snap is racy. Instead, signal the main
|
||||||
// loop above.
|
// loop above.
|
||||||
sendCh <- struct{}{}
|
select {
|
||||||
|
case sendCh <- struct{}{}:
|
||||||
|
case <-ctx.Done():
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue