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: Redis.Cluster constructor support #1066

Merged
merged 5 commits into from
Apr 15, 2021
Merged

feat: Redis.Cluster constructor support #1066

merged 5 commits into from
Apr 15, 2021

Conversation

onichandame
Copy link
Contributor

@onichandame onichandame commented Apr 14, 2021

Problem

I'm using the following practice:

const isUnittest = process.env.NODE_ENV === `unittest`
const Redis = require(isUnittest ? `ioredis-mock` : `ioredis`)

const cluster = new Redis.Cluster([`redis://xxxxx:6379`])
 // more code here

But this lib does not seem to support cluster creation yet.

Solution

The Redis.Cluster constructor is all I need, hence I didn't dig deeply into the internal mechanisms of the redis cluster. I know this is far from complete, so feel free to give advice or simply reject for good :D

Related to #359

@codeclimate
Copy link

codeclimate bot commented Apr 14, 2021

Code Climate has analyzed commit 80db0e7 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (80% is the threshold).

This pull request will bring the total coverage in the repository to 98.3% (0.0% change).

View more on Code Climate.

Copy link
Owner

@stipsan stipsan left a comment

Choose a reason for hiding this comment

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

Great starting point! When I started this library I knew little about redis or ioredis, and you could call this whole library a "poor man's ioredis mock" 😂

After applying the review suggestions run these commands, commit and push: npm run lint -- --fix && npx prettier --write . 😄

onichandame and others added 4 commits April 15, 2021 15:14
Co-authored-by: Cody Olsen <stipsan@gmail.com>
Co-authored-by: Cody Olsen <stipsan@gmail.com>
@onichandame
Copy link
Contributor Author

It seems that pre-commit or pre-push hooks could help enforce the linting and formating of PRs. http://npmjs.com/package/husky

@stipsan stipsan changed the title poor man's cluster feat: Redis.Cluster constructor support Apr 15, 2021
@stipsan stipsan merged commit d6591b5 into stipsan:master Apr 15, 2021
@stipsan
Copy link
Owner

stipsan commented Apr 15, 2021

@onichandame yup it's set up but it appears to have stopped working after v5 or something 🤔 Haven't had time to look into what's up...

@stipsan
Copy link
Owner

stipsan commented Apr 15, 2021

🎉 This PR is included in version 5.5.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants