diff options
author | Valery Piashchynski <[email protected]> | 2021-06-05 21:28:09 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2021-06-05 21:28:09 +0300 |
commit | 7995c44d47075cca01c44120e5617d1d90b2a039 (patch) | |
tree | 83f9c35ff54945bd8173d0e7201234d17341007c /plugins/redis | |
parent | d0ec24066b5fbb4e3accc9c45f72f7c638b35dba (diff) |
- Switch to better gzip middleware (performance)
- Use EXISTS to check of the particular topic exists in the redis
cluster instead of SMEMBERS
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'plugins/redis')
-rw-r--r-- | plugins/redis/plugin.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/plugins/redis/plugin.go b/plugins/redis/plugin.go index 7b5721f4..b2603a40 100644 --- a/plugins/redis/plugin.go +++ b/plugins/redis/plugin.go @@ -164,14 +164,14 @@ func (p *Plugin) Unsubscribe(connectionID string, topics ...string) error { for i := 0; i < len(topics); i++ { // if there are no such topics, we can safely unsubscribe from the redis - ssc := p.universalClient.SMembers(context.Background(), topics[i]) - res, err := ssc.Result() + exists := p.universalClient.Exists(context.Background(), topics[i]) + res, err := exists.Result() if err != nil { return err } // if we have associated connections - skip - if len(res) > 0 { + if res == 1 { // exists means that topic still exists and some other nodes may have connections associated with it continue } |