Skip to content

How to not wait connection for get command #1888

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

Closed
mogadanez opened this issue Feb 1, 2022 · 4 comments
Closed

How to not wait connection for get command #1888

mogadanez opened this issue Feb 1, 2022 · 4 comments
Labels

Comments

@mogadanez
Copy link

I'm using Redis as an optional cache layer.
if its failed to connect - it is wait infinitely on GET command and not

tried to set commandsQueueMaxLength:0

is it any other way to change behavior to fail on operations if its not yet connected?
or in worse case specify operation timeout

Environment:

  • Node.js Version: 14
  • Redis Server Version: 6.0.5
  • Node Redis Version: 4.0.3
  • Platform: Mac OS 12
@mogadanez mogadanez added the Bug label Feb 1, 2022
@NathanielWroblewski
Copy link

NathanielWroblewski commented Feb 2, 2022

Experiencing the same issue where client.get hangs infinitely (node-redis version ^4.0.0)

@leibale leibale added feature and removed Bug labels Feb 7, 2022
leibale added a commit to leibale/node-redis that referenced this issue Feb 7, 2022
leibale added a commit that referenced this issue Feb 14, 2022
* ref #1888 - add disableOfflineQueue

* fix flushQueuesOnError

* update docs

Co-authored-by: Guy Royse <[email protected]>

Co-authored-by: Guy Royse <[email protected]>
@leibale
Copy link
Contributor

leibale commented Feb 14, 2022

@mogadanez @NathanielWroblewski dose the new disableOfflineQueue feature solves this issue? (it's not in npm yet)

@mnoorenberghe
Copy link

dose the new disableOfflineQueue feature solves this issue?

It helps but it's still not straightforward to configure this client as an optional cache layer. Ideally the client would reconnect in parallel to returning failures on get/set but currently it seems like get/set still block on some of the reconnectStrategy's attempts so the redis client can actually add latency to a request rather than speeding up data accesses (depending on the number used for the reconnect timeout).

@leibale
Copy link
Contributor

leibale commented Feb 24, 2023

@mnoorenberghe sorry for the huge delay... when disableOfflineQueue is true, when the socket disconnects all the commands in the queue will be rejected immediately.

@leibale leibale closed this as completed Feb 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants