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

feat: restore passOnConnectionError option #193

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gamemaker1
Copy link
Member

@gamemaker1 gamemaker1 commented Sep 13, 2023

This PR closes #190.

It works like a charm with an ioredis client. However, the node-redis client is a bit stubborn when it comes to reconnecting - it waits for the server to reconnect forever. If you use a custom retryStrategy that tells it to stop after x retries, it will stop and not attempt to reconnect, even during the next time increment is called. I haven't yet figured out a workaround for that.

@gamemaker1 gamemaker1 marked this pull request as ready for review September 13, 2023 16:40
@gamemaker1
Copy link
Member Author

@nfriedly @abhijeetviswa Please do review this PR and let me know if I should make any changes.

Copy link
Member

@nfriedly nfriedly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @gamemaker1 , sorry I didn't think of this before you did all this work, but I think the passOnConnectionError option should be in express-rate-limit, rather than here, so that it can be used with any store. I think the store itself should just throw an error.

throw new TypeError('unexpected reply from redis client')
}
if (typeof result !== 'string')
throw new TypeError('Expected result to be the script SHA')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
throw new TypeError('Expected result to be the script SHA')
throw new TypeError(`Expected result of SCRIPT LOAD command to be the script SHA, got ${result}`)

@gamemaker1
Copy link
Member Author

Oh all right that makes sense

Copy link

@abhijeetviswa abhijeetviswa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes itself looks good. I'll leave the design discussions to y'all. Thanks

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

Successfully merging this pull request may close these issues.

PromiseRejectionHandledWarning: Promise rejection was handled asynchronously
3 participants