You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
func (c *Consumer) worker(ctx context.Context, workerID int32) {
var lock *redislock.Lock
defer func() {
if lock != nil {
_ = lock.Release(ctx)
}
}()
timer := time.NewTimer(time.Minute)
timer.Stop()
for {
if workerID >= atomic.LoadInt32(&c.numWorker) {
return
}
if c.opt.WorkerLimit > 0 {
lock = c.lockWorker(ctx, lock, workerID)
}
msg := c.waitMessage(ctx, timer)
if msg == nil {
if atomic.LoadInt32(&c.state) >= stateStoppingWorkers {
return
}
continue
}
msg.Ctx = ctx // this place
_ = c.Process(msg)
}
}
if we use consumer's context, we will not use the redis queue's message's context, it's a specified context which definited by the sdk users, it may contains some their own context's value, so I think it's better to remove the line "msg.Ctx = ctx", let users use their context.
The text was updated successfully, but these errors were encountered:
if we use consumer's context, we will not use the redis queue's message's context, it's a specified context which definited by the sdk users, it may contains some their own context's value, so I think it's better to remove the line "msg.Ctx = ctx", let users use their context.
The text was updated successfully, but these errors were encountered: