This commit is contained in:
Yandi Lee 2025-03-05 22:45:39 +01:00 committed by GitHub
commit bfc516d2f8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 12 additions and 4 deletions

View file

@ -350,8 +350,10 @@ func (m *Manager) updater(ctx context.Context, p *Provider, updates chan []*targ
func (m *Manager) sender() {
ticker := time.NewTicker(m.updatert)
defer ticker.Stop()
defer func() {
ticker.Stop()
close(m.syncCh)
}()
for {
select {
case <-m.ctx.Done():

View file

@ -380,7 +380,10 @@ func (n *Manager) targetUpdateLoop(tsets <-chan map[string][]*targetgroup.Group)
select {
case <-n.stopRequested:
return
case ts := <-tsets:
case ts, ok := <-tsets:
if !ok {
break
}
n.reload(ts)
}
}

View file

@ -122,7 +122,10 @@ func (m *Manager) Run(tsets <-chan map[string][]*targetgroup.Group) error {
go m.reloader()
for {
select {
case ts := <-tsets:
case ts, ok := <-tsets:
if !ok {
break
}
m.updateTsets(ts)
select {