go-redis
go-redis copied to clipboard
[feature request] make BLPop return a Channel
Hey,
thank you for the amazing project!
I remember Subscribe used to block, and now it returns a Channel, which is so much cooler. Can it be also done for BLPop?
Our use case is as following:
func getItem(){
ctx := makeContext()
go func(){
item := redis.BLPop()
// some more code
switch {
case <-ctx.Done(): return
}
}
}
As you can see, now we have 2 places where function can be blocked. Wouldn't it be neat to have it all in the switch?
func getItem(){
ctx := makeContext()
go func(){
switch {
case <-ctx.Done(): return
case item <- redis.BLPop().Channel():
// do stuff with item
}
}
}
This would be a workaround to https://github.com/redis/go-redis/issues/2556
This issue is marked stale. It will be closed in 30 days if it is not updated.