-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
refactor: Use options pattern in RedisPool constructor #468
refactor: Use options pattern in RedisPool constructor #468
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Sorry for the late review, @jcw-. Thanks for opening this PR 👍 |
No worries at all, thanks for the suggestion! |
this.redisPool = pool; | ||
} | ||
|
||
async getClient() { | ||
return await this.redisPool.getClient(); | ||
return this.redisPool.getClient(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just out of interest, does removing the await
change the semantics of getClient()
? It seems like it now returns a promise that needs to be await
-ed, whereas before the result of the promise was returned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hassankhan await
required if you have try/catch/finally block inside a method. Otherwise it works the same way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, it was the linting that led me to remove that, this rule violation was triggered (not sure why I didn't notice it originally): https://eslint.org/docs/rules/no-return-await
@jcw- Looks great! Thanks for providing it! |
Check List
Description of Changes Made (if issue reference is not provided)
Instead of passing in values directly through the constructor, use the options pattern for easier extensibility.
From a review of #433