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)
| 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. |
| 668 | func (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. |