|
|
@ -76,7 +76,6 @@ func (n *Notifier) Send(ctx context.Context) {
|
|
|
|
n.c <- ctx
|
|
|
|
n.c <- ctx
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// TODO(wperron) is there a (nice) way to instrument this function?
|
|
|
|
|
|
|
|
func (n *Notifier) NotifyFunc(ctx context.Context, f func(context.Context)) {
|
|
|
|
func (n *Notifier) NotifyFunc(ctx context.Context, f func(context.Context)) {
|
|
|
|
for {
|
|
|
|
for {
|
|
|
|
select {
|
|
|
|
select {
|
|
|
@ -84,8 +83,11 @@ func (n *Notifier) NotifyFunc(ctx context.Context, f func(context.Context)) {
|
|
|
|
log.Debug().Msg("context deadline exceeded, exiting notify func")
|
|
|
|
log.Debug().Msg("context deadline exceeded, exiting notify func")
|
|
|
|
return
|
|
|
|
return
|
|
|
|
case innerCtx := <-n.c:
|
|
|
|
case innerCtx := <-n.c:
|
|
|
|
|
|
|
|
innerCtx, span := tracer.Start(innerCtx, "notify_func")
|
|
|
|
log.Debug().Ctx(innerCtx).Msg("tick received, notifying function")
|
|
|
|
log.Debug().Ctx(innerCtx).Msg("tick received, notifying function")
|
|
|
|
|
|
|
|
|
|
|
|
f(innerCtx)
|
|
|
|
f(innerCtx)
|
|
|
|
|
|
|
|
span.End()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
time.Sleep(time.Second)
|
|
|
|
time.Sleep(time.Second)
|
|
|
|
}
|
|
|
|
}
|
|
|
|