Merge pull request #2231 from j178/fix-pubsub

fix(pubsub): fix break introduced by #2177
This commit is contained in:
Vladimir Mihailenco 2022-10-06 08:59:57 +03:00 committed by GitHub
commit 24d4a2d579
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -352,7 +352,7 @@ type Cmdable interface {
PubSubNumSub(ctx context.Context, channels ...string) *MapStringIntCmd PubSubNumSub(ctx context.Context, channels ...string) *MapStringIntCmd
PubSubNumPat(ctx context.Context) *IntCmd PubSubNumPat(ctx context.Context) *IntCmd
PubSubShardChannels(ctx context.Context, pattern string) *StringSliceCmd PubSubShardChannels(ctx context.Context, pattern string) *StringSliceCmd
PubSubShardNumSub(ctx context.Context, channels ...string) *StringIntMapCmd PubSubShardNumSub(ctx context.Context, channels ...string) *MapStringIntCmd
ClusterSlots(ctx context.Context) *ClusterSlotsCmd ClusterSlots(ctx context.Context) *ClusterSlotsCmd
ClusterNodes(ctx context.Context) *StringCmd ClusterNodes(ctx context.Context) *StringCmd
@ -3122,14 +3122,14 @@ func (c cmdable) PubSubShardChannels(ctx context.Context, pattern string) *Strin
return cmd return cmd
} }
func (c cmdable) PubSubShardNumSub(ctx context.Context, channels ...string) *StringIntMapCmd { func (c cmdable) PubSubShardNumSub(ctx context.Context, channels ...string) *MapStringIntCmd {
args := make([]interface{}, 2+len(channels)) args := make([]interface{}, 2+len(channels))
args[0] = "pubsub" args[0] = "pubsub"
args[1] = "shardnumsub" args[1] = "shardnumsub"
for i, channel := range channels { for i, channel := range channels {
args[2+i] = channel args[2+i] = channel
} }
cmd := NewStringIntMapCmd(ctx, args...) cmd := NewMapStringIntCmd(ctx, args...)
_ = c(ctx, cmd) _ = c(ctx, cmd)
return cmd return cmd
} }

View File

@ -565,7 +565,7 @@ func (c *Ring) SSubscribe(ctx context.Context, channels ...string) *PubSub {
if len(channels) == 0 { if len(channels) == 0 {
panic("at least one channel is required") panic("at least one channel is required")
} }
shard, err := c.shards.GetByKey(channels[0]) shard, err := c.sharding.GetByKey(channels[0])
if err != nil { if err != nil {
// TODO: return PubSub with sticky error // TODO: return PubSub with sticky error
panic(err) panic(err)