-
Notifications
You must be signed in to change notification settings - Fork 41
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
language: node_js | ||
node_js: | ||
- 4 | ||
- 6 | ||
- '4' | ||
- '6' | ||
- '8' | ||
- '10' | ||
sudo: false | ||
cache: | ||
yarn: true | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ module.exports = CoreObject.extend({ | |
init: function(options, lib) { | ||
this._super(); | ||
var redisOptions = {}; | ||
var redisLib = lib; | ||
var RedisLib = lib; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I capitalized this because you call the the constructor with |
||
|
||
if (options.url) { | ||
redisOptions = this._stripUsernameFromConfigUrl(options.url); | ||
|
@@ -21,15 +21,15 @@ module.exports = CoreObject.extend({ | |
} | ||
|
||
if (options.database) { | ||
redisOptions.database = options.database; | ||
redisOptions.db = options.database; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I left the API the same here, but |
||
} | ||
} | ||
|
||
if (!redisLib) { | ||
redisLib = require('then-redis'); | ||
if (!RedisLib) { | ||
RedisLib = require('ioredis'); | ||
} | ||
|
||
this._client = redisLib.createClient(redisOptions); | ||
this._client = new RedisLib(redisOptions); | ||
|
||
this._maxRecentUploads = options.maxRecentUploads; | ||
this._allowOverwrite = options.allowOverwrite; | ||
|
@@ -204,13 +204,16 @@ module.exports = CoreObject.extend({ | |
if (!revisions) { | ||
return; | ||
} | ||
var promises = []; | ||
revisions.forEach(function(revision) { | ||
if (revision !== current) { | ||
client.del(keyPrefix + ":" + revision); | ||
client.del(keyPrefix + ":revision-data:" + revision); | ||
client.zrem(listKey, revision); | ||
promises.push(client.del(keyPrefix + ":" + revision)); | ||
promises.push(client.del(keyPrefix + ":revision-data:" + revision)); | ||
promises.push(client.zrem(listKey, revision)); | ||
} | ||
}); | ||
|
||
return RSVP.all(promises); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
}); | ||
}, | ||
|
||
|
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.
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