leaking ticker
parent
5c4d63daa0
commit
67ca5f13f7
|
@ -57,11 +57,14 @@ func (s *DefaultManager) Start(ctx context.Context) error {
|
|||
}).Error("trigger.poll.manager: scan failed")
|
||||
}
|
||||
|
||||
for _ = range time.Tick(time.Duration(s.scanTick) * time.Second) {
|
||||
ticker := time.NewTicker(time.Duration(s.scanTick) * time.Second)
|
||||
defer ticker.Stop()
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return nil
|
||||
default:
|
||||
case <-ticker.C:
|
||||
log.Debug("performing scan")
|
||||
err := s.scan(ctx)
|
||||
if err != nil {
|
||||
|
@ -71,8 +74,6 @@ func (s *DefaultManager) Start(ctx context.Context) error {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *DefaultManager) scan(ctx context.Context) error {
|
||||
|
|
Loading…
Reference in New Issue