NewRedisTaskQueue returns new telemetry task queue.
( ctx context.Context, cl *ttnredis.Client, maxLen int64, group string, streamBlockLimit time.Duration, )
| 76 | |
| 77 | // NewRedisTaskQueue returns new telemetry task queue. |
| 78 | func NewRedisTaskQueue( |
| 79 | ctx context.Context, cl *ttnredis.Client, maxLen int64, group string, streamBlockLimit time.Duration, |
| 80 | ) (TaskQueue, TaskQueueCloser, error) { |
| 81 | tq := &RedisTaskQueue{ |
| 82 | queue: &ttnredis.TaskQueue{ |
| 83 | Redis: cl, |
| 84 | MaxLen: maxLen, |
| 85 | Group: group, |
| 86 | Key: cl.Key(telemetryKey), |
| 87 | StreamBlockLimit: streamBlockLimit, |
| 88 | }, |
| 89 | } |
| 90 | if err := tq.Init(ctx); err != nil { |
| 91 | return nil, nil, err |
| 92 | } |
| 93 | |
| 94 | return tq, tq.Close, nil |
| 95 | } |
| 96 | |
| 97 | // Init initializes the TelemetryTaskQueue. |
| 98 | func (q *RedisTaskQueue) Init(ctx context.Context) error { |