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

Method Close

pkg/redis/redis.go:646–656  ·  view source on GitHub ↗

Close closes the TaskQueue.

(ctx context.Context)

Source from the content-addressed store, hash-verified

644
645// Close closes the TaskQueue.
646func (q *TaskQueue) Close(ctx context.Context) error {
647 _, err := q.Redis.Pipelined(ctx, func(p redis.Pipeliner) error {
648 q.consumerIDs.Range(func(k, v any) bool {
649 p.XGroupDelConsumer(ctx, InputTaskKey(q.Key), q.Group, k.(string))
650 p.XGroupDelConsumer(ctx, ReadyTaskKey(q.Key), q.Group, k.(string))
651 return true
652 })
653 return nil
654 })
655 return ConvertError(err)
656}
657
658// Add adds a task s to the queue with a timestamp startAt.
659func (q *TaskQueue) Add(ctx context.Context, r redis.Cmdable, s string, startAt time.Time, replace bool) error {

Callers 1

TestTaskQueueFunction · 0.95

Implementers 2

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

Calls 4

InputTaskKeyFunction · 0.85
ReadyTaskKeyFunction · 0.85
ConvertErrorFunction · 0.85
RangeMethod · 0.65

Tested by 1

TestTaskQueueFunction · 0.76