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

Function initTaskGroup

pkg/redis/redis.go:439–449  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
439func 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.

Callers 1

InitMethod · 0.85

Calls 4

InputTaskKeyFunction · 0.85
ReadyTaskKeyFunction · 0.85
IsConsumerGroupExistsErrFunction · 0.85
ConvertErrorFunction · 0.85

Tested by

no test coverage detected