Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible inefficiency on reconnect #366

Open
edemaine opened this issue Oct 2, 2020 · 0 comments
Open

Possible inefficiency on reconnect #366

edemaine opened this issue Oct 2, 2020 · 0 comments

Comments

@edemaine
Copy link

edemaine commented Oct 2, 2020

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.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant