Skip to content

Possible inefficiency on reconnect #366

@edemaine

Description

@edemaine

For #365 I've been reading over the reconnect code. If I'm reading https://github.com/cult-of-coders/redis-oplog/blob/master/lib/redis/RedisSubscriptionManager.js correctly:

  • attach() may add the same redisSubscriber to this.store[channel] for multiple channels.
  • getAllRedisSubscribers() will then get all copies of all redisSubscribers, causing onConnect() to reload some subscribers many times.

Assuming folks agree with me, I'm happy to prepare a PR where getAllRedisSubscribers deduplicates all the redisSubscribers using a Set. But I just wanted to double-check I'm not missing something first.

(In my application, I'm pretty sure each redisSubscriber has only one relevant channel, so this doesn't affect me. But it struck me when reading the code.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions