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

Replace then-redis with ioredis #86

Merged

Conversation

blimmer
Copy link
Contributor

@blimmer blimmer commented Aug 30, 2018

What Changed & Why

This PR replaces then-redis with ioredis. then-redis has been deprecated, so we needed to replace it with something.

I chose ioredis over the node_redis package because they require Node 8 or higher for native promise support, or you have to promisify via Bluebird.

Also note that I've used ioredis < 4 because of their requirement of Node 6 or greater. As ember-cli support drops out for Node 4, we should be able to upgrade to the newer versions.

I've tested this using yarn link deploying my Ember 2.16 application and have not had any problems.

Related issues

Fixes #51
Fixes #74

PR Checklist

  • Add tests
  • Add documentation (the API should remain the same, so no docs required)

People

@ghedamat

Also, significantly reduce mocking in the test suite by using an
in-memory redis client.
Fixes ember-cli-deploy#51
Fixes ember-cli-deploy#74
Copy link
Contributor Author

@blimmer blimmer left a comment

Choose a reason for hiding this comment

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

The test files have changed pretty significantly, so GitHub has collapsed them. I'd recommend viewing the files outside of a diff-mode for the best experience.

@@ -6,7 +6,7 @@ module.exports = CoreObject.extend({
init: function(options, lib) {
this._super();
var redisOptions = {};
var redisLib = lib;
var RedisLib = lib;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I capitalized this because you call the the constructor with ioredis instead of createClient. It made more sense to me to call new RedisLib() instead of new redisLib().

@@ -21,15 +21,15 @@ module.exports = CoreObject.extend({
}

if (options.database) {
redisOptions.database = options.database;
redisOptions.db = options.database;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I left the API the same here, but then-redis was pretty much the only library to call this parameter database instead of db.

}
});

return RSVP.all(promises);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was seeing flaky tests when we weren't waiting on these promises, so I wrapped it in an RSVP.all so we wait for all the redis operations to complete.

- '4'
- '6'
- '8'
- '10'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've added node 8 and 10 since they're technically supported.

https://github.com/ember-cli/ember-cli/blob/master/docs/node-support.md

Copy link
Contributor

@lukemelia lukemelia left a comment

Choose a reason for hiding this comment

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

Looks great @blimmer. Thanks for taking the initiative on this!

@blimmer
Copy link
Contributor Author

blimmer commented Aug 31, 2018

No problem - thank you for reviewing. This should be safe to merge and release.

@ghedamat
Copy link
Contributor

@blimmer I discussed to day w/ @lukemelia

I'm gonna do a light QA of this pr on one of our apps at work just as a second sanity check and then I'll merge and release!

Will try to get to this during the weekend! If I don't please nag me here or on slack!

thanks again !

@ghedamat ghedamat merged commit 1931bb4 into ember-cli-deploy:master Sep 1, 2018
@blimmer blimmer deleted the feature/replace-then-redis branch September 4, 2018 15:18
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.

None yet

3 participants