MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / CallbackWithInterval

Function CallbackWithInterval

pkg/telemetry/exporter/task_queue.go:67–75  ·  view source on GitHub ↗

CallbackWithInterval is a wrapper that takes a task.Func and a time.Duration and returns a TaskCallback.

(_ context.Context, interval time.Duration, callback task.Func)

Source from the content-addressed store, hash-verified

65
66// CallbackWithInterval is a wrapper that takes a task.Func and a time.Duration and returns a TaskCallback.
67func CallbackWithInterval(_ context.Context, interval time.Duration, callback task.Func) TaskCallback {
68 return func(ctx context.Context) (time.Time, error) {
69 t := time.Now().Add(interval)
70 if err := callback(ctx); err != nil {
71 return t, err
72 }
73 return t, nil
74 }
75}
76
77// NewRedisTaskQueue returns new telemetry task queue.
78func NewRedisTaskQueue(

Callers

nothing calls this directly

Calls 2

AddMethod · 0.65
NowMethod · 0.65

Tested by

no test coverage detected