initTaskGroup initializes the task group for streams at InputTaskKey(k) and ReadyTaskKey(k). It must be called before all other task-related functions at subkeys of k.
(ctx context.Context, r redis.Cmdable, group, k string)
| 437 | // initTaskGroup initializes the task group for streams at InputTaskKey(k) and ReadyTaskKey(k). |
| 438 | // It must be called before all other task-related functions at subkeys of k. |
| 439 | func initTaskGroup(ctx context.Context, r redis.Cmdable, group, k string) error { |
| 440 | _, err := r.Pipelined(ctx, func(p redis.Pipeliner) error { |
| 441 | p.XGroupCreateMkStream(ctx, InputTaskKey(k), group, "$") |
| 442 | p.XGroupCreateMkStream(ctx, ReadyTaskKey(k), group, "$") |
| 443 | return nil |
| 444 | }) |
| 445 | if IsConsumerGroupExistsErr(err) { |
| 446 | return nil |
| 447 | } |
| 448 | return ConvertError(err) |
| 449 | } |
| 450 | |
| 451 | // addTask adds a task identified by payload with timestamp startAt to the stream at InputTaskKey(k). |
| 452 | // maxLen is the approximate length of the stream, to which it may be trimmed. |
no test coverage detected