'passIfNotConnected' option is not compatible with ioredis client
See original GitHub issueI love the idea of the passIfNotConnected
option that was recently added in https://github.com/wyattjoh/rate-limit-redis/pull/29
However, it is based on the redis
(“node-redis”) client implementation of the client.connected
Boolean, which is not compatible with the ioredis
client.
In ioredis
, they seem to use the following complex set of checks for determining if the client is connected (e.g. source example):
if (
this.status === "connecting" ||
this.status === "connect" ||
this.status === "ready"
) {
reject(new Error("Redis is already connecting/connected"));
return;
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
rate-limit-redis works with redis and not with ioredis #38 - GitHub
We're migrating from the redis module to ioredis. ... generates an error message: redis client is not connected, rate-limit-redis disabled!
Read more >Redis with Node.js (ioredis) | Redis Documentation Center
js Redis client. The following sections demonstrate the use of ioredis, a community-recommended Redis client for Node.js with build-in support for promises.
Read more >ioredis connection keeps resetting when connecting to local ...
I had to use the natMap option in the ioredis client to remap the internal cluster network connections to the network address of...
Read more >API - ioredis - Read the Docs
While loading, the server not respond to any commands. To work around this, when this option is true , ioredis will check the...
Read more >Migrating from Node Redis to Ioredis: a slightly bumpy but ...
Here's how and why we migrated from Node Redis client library to Ioredis to suit ... by the client libraries themselves, but were...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi, I’m the author of ioredis (and contributor of node_redis) and happened to see this issue. Thank @JamesMGreene for pointing this out!
I think to better reflect the intent, we should check
.ready
instead of.connected
as when.connected
is true, the client may be not ready to send/receive commands.The equivalent of
.ready
in ioredis is.status === 'ready'
. So to support ioredis, the easiest change would be changing the following code in redis-store.js:To:
Looks good to me. To be more complete:
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.