Ensure ticker stop
parent
bfda034655
commit
fb13df273a
|
@ -169,8 +169,10 @@ func (p *Poller) Run(ctx context.Context) (chan Update, error) {
|
||||||
return nil, fmt.Errorf("error initializing poller: %w", p.initErr)
|
return nil, fmt.Errorf("error initializing poller: %w", p.initErr)
|
||||||
}
|
}
|
||||||
tick := time.NewTicker(p.Interval)
|
tick := time.NewTicker(p.Interval)
|
||||||
|
go func() {
|
||||||
defer tick.Stop()
|
defer tick.Stop()
|
||||||
go p.runWithTickChan(ctx, tick.C)
|
p.runWithTickChan(ctx, tick.C)
|
||||||
|
}()
|
||||||
return p.c, nil
|
return p.c, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue