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

Method Dispatch

pkg/redis/redis.go:668–674  ·  view source on GitHub ↗

Dispatch dispatches the tasks of the queue. It will continue to run until the context is done. consumerID is used to identify the consumer and should be unique for all concurrent calls to Dispatch.

(ctx context.Context, consumerID string, r redis.Cmdable)

Source from the content-addressed store, hash-verified

666// Dispatch dispatches the tasks of the queue. It will continue to run until the context is done.
667// consumerID is used to identify the consumer and should be unique for all concurrent calls to Dispatch.
668func (q *TaskQueue) Dispatch(ctx context.Context, consumerID string, r redis.Cmdable) error {
669 q.consumerIDs.LoadOrStore(consumerID, struct{}{})
670 if r == nil {
671 r = q.Redis
672 }
673 return dispatchTask(ctx, r, q.Group, consumerID, q.MaxLen, q.Key, q.StreamBlockLimit)
674}
675
676// Pop calls f on the most recent task in the queue, for which timestamp is in range [0, time.Now()],
677// if such is available, otherwise it blocks until it is or context is done.

Callers 1

TestTaskQueueFunction · 0.95

Implementers 2

mockTaskQueuepkg/telemetry/exporter/task_queue_test
RedisTaskQueuepkg/telemetry/exporter/task_queue.go

Calls 1

dispatchTaskFunction · 0.85

Tested by 1

TestTaskQueueFunction · 0.76