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

refactor: Use options pattern in RedisPool constructor #468

Merged

Conversation

jcw-
Copy link
Contributor

@jcw- jcw- commented Mar 3, 2020

Check List

  • Tests has been run in packages where changes made if available
  • Linter has been run for changed code
  • Tests for the changes have been added if not covered yet
  • Docs have been added / updated if required

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

@jcw- jcw- mentioned this pull request Mar 3, 2020
4 tasks
Copy link
Contributor

@hassankhan hassankhan left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@hassankhan
Copy link
Contributor

Sorry for the late review, @jcw-. Thanks for opening this PR 👍

@jcw-
Copy link
Contributor Author

jcw- commented Mar 3, 2020

No worries at all, thanks for the suggestion!

this.redisPool = pool;
}

async getClient() {
return await this.redisPool.getClient();
return this.redisPool.getClient();
Copy link
Contributor

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.

Copy link
Member

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.

Copy link
Contributor Author

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

@paveltiunov
Copy link
Member

@jcw- Looks great! Thanks for providing it!

@paveltiunov paveltiunov merged commit ff20167 into cube-js:master Mar 3, 2020
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.

3 participants