fix 消息无法订阅问题

fix 可能出现重复爬虫的问题
This commit is contained in:
陈景阳
2019-09-10 14:26:50 +08:00
parent 27f36cf91f
commit f20039fefd
2 changed files with 37 additions and 12 deletions

View File

@@ -19,7 +19,7 @@ func (r *Redis) Close() {
}
func (r *Redis) subscribe(ctx context.Context, consume ConsumeFunc, channel ...string) error {
psc := redis.PubSubConn{Conn: r.pool.Get()}
if err := psc.Subscribe(redis.Args{}.AddFlat(channel)); err != nil {
if err := psc.Subscribe(redis.Args{}.AddFlat(channel)...); err != nil {
return err
}
done := make(chan error, 1)