Closed ksppg closed 2 months ago
In go-redis, when executing BLPOP/BRPOP, the command's timeout parameter will override the default timeout, so the timeout setting comes from the user.
func (c cmdable) BLPop(ctx context.Context, timeout time.Duration, keys ...string) *StringSliceCmd {
args := make([]interface{}, 1+len(keys)+1)
args[0] = "blpop"
for i, key := range keys {
args[1+i] = key
}
args[len(args)-1] = formatSec(ctx, timeout)
cmd := NewStringSliceCmd(ctx, args...)
cmd.setReadTimeout(timeout)
_ = c(ctx, cmd)
return cmd
}
Do you mean something else?
https://www.jianshu.com/p/a41b62c2afab