Skip to content

Commit

Permalink
skip processing failed tick
Browse files Browse the repository at this point in the history
  • Loading branch information
jmank88 committed Oct 23, 2024
1 parent d6daff8 commit c17613b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/v3/tickers/time.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,16 @@ func (t *timeTicker[T]) Start(ctx context.Context) error {

for {
select {
case <-ctx.Done():
return nil
case tm := <-ticker.C:
if t.getterFn == nil {
continue
}
tick, err := t.getterFn(ctx, tm)
if err != nil {
t.logger.Printf("error fetching tick: %s", err.Error())
continue
}
// observer.Process can be a heavy call taking upto ObservationProcessLimit seconds
// so it is run in a separate goroutine to not block further ticks
Expand All @@ -72,8 +75,6 @@ func (t *timeTicker[T]) Start(ctx context.Context) error {
l.Printf("error processing observer: %s", err.Error())
}
}(ctx, tick, t.observer, t.logger)
case <-ctx.Done():
return nil
}
}
}
Expand Down

0 comments on commit c17613b

Please sign in to comment.