Pop calls f on the most recent task in the queue, for which timestamp is in range [0, time.Now()], if such is available, otherwise it blocks until it is or context is done. Pipeline is executed even if f returns an error. consumerID is used to identify the consumer and should be unique for all concu
(ctx context.Context, consumerID string, r redis.Cmdable, f func(redis.Pipeliner, string, time.Time) error)
| 678 | // Pipeline is executed even if f returns an error. |
| 679 | // consumerID is used to identify the consumer and should be unique for all concurrent calls to Pop. |
| 680 | func (q *TaskQueue) Pop(ctx context.Context, consumerID string, r redis.Cmdable, f func(redis.Pipeliner, string, time.Time) error) error { |
| 681 | q.consumerIDs.LoadOrStore(consumerID, struct{}{}) |
| 682 | if r == nil { |
| 683 | r = q.Redis |
| 684 | } |
| 685 | return popTask(ctx, r, q.Group, consumerID, f, q.Key, q.StreamBlockLimit) |
| 686 | } |
| 687 | |
| 688 | var deduplicateProtosScript = redis.NewScript(`local exp = table.remove(ARGV, 1) |
| 689 | local limit = tonumber(table.remove(ARGV, 1)) |