Merge pull request #458 from CartoDB/redis4

Redis4 support
This commit is contained in:
Simon Martín 2018-02-12 15:59:45 +01:00 committed by GitHub
commit f31423b25b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 74 additions and 48 deletions

View File

@ -10,6 +10,8 @@ Announcements:
* Logging all errors
* Fix Postgres version in travis
* Fix Python timeout error
* Upgrades redis-mpool to 0.5.0
* Upgrades cartodb-redis to 0.15.0
## 1.47.1

View File

@ -61,7 +61,17 @@ function isJobFound(redisValues) {
return !!(redisValues[0] && redisValues[1] && redisValues[2] && redisValues[3] && redisValues[4]);
}
function getNotFoundError(job_id) {
var notFoundError = new Error('Job with id ' + job_id + ' not found');
notFoundError.name = 'NotFoundError';
return notFoundError;
}
JobBackend.prototype.get = function (job_id, callback) {
if (!job_id) {
return callback(getNotFoundError(job_id));
}
var self = this;
var redisParams = [
REDIS_PREFIX + job_id,
@ -81,9 +91,7 @@ JobBackend.prototype.get = function (job_id, callback) {
}
if (!isJobFound(redisValues)) {
var notFoundError = new Error('Job with id ' + job_id + ' not found');
notFoundError.name = 'NotFoundError';
return callback(notFoundError);
return callback(getNotFoundError(job_id));
}
var jobData = toObject(job_id, redisParams, redisValues);

97
npm-shrinkwrap.json generated
View File

@ -17,11 +17,6 @@
"from": "ansi-styles@>=2.2.1 <3.0.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz"
},
"ap": {
"version": "0.2.0",
"from": "ap@>=0.2.0 <0.3.0",
"resolved": "https://registry.npmjs.org/ap/-/ap-0.2.0.tgz"
},
"append-field": {
"version": "0.1.0",
"from": "append-field@>=0.1.0 <0.2.0",
@ -101,9 +96,9 @@
}
},
"bluebird": {
"version": "3.5.0",
"version": "3.5.1",
"from": "bluebird@>=3.3.3 <4.0.0",
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.0.tgz"
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz"
},
"boom": {
"version": "2.10.1",
@ -158,9 +153,9 @@
"resolved": "https://registry.npmjs.org/cartodb-query-tables/-/cartodb-query-tables-0.2.0.tgz"
},
"cartodb-redis": {
"version": "0.14.0",
"from": "cartodb-redis@0.14.0",
"resolved": "https://registry.npmjs.org/cartodb-redis/-/cartodb-redis-0.14.0.tgz"
"version": "0.15.0",
"from": "cartodb-redis@0.15.0",
"resolved": "https://registry.npmjs.org/cartodb-redis/-/cartodb-redis-0.15.0.tgz"
},
"caseless": {
"version": "0.11.0",
@ -188,9 +183,9 @@
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz"
},
"commander": {
"version": "2.11.0",
"version": "2.14.1",
"from": "commander@>=2.9.0 <3.0.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz"
"resolved": "https://registry.npmjs.org/commander/-/commander-2.14.1.tgz"
},
"concat-map": {
"version": "0.0.1",
@ -225,9 +220,9 @@
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.1.tgz"
},
"content-type": {
"version": "1.0.2",
"version": "1.0.4",
"from": "content-type@>=1.0.1 <1.1.0",
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.2.tgz"
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz"
},
"cookie": {
"version": "0.1.5",
@ -277,9 +272,9 @@
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz"
},
"depd": {
"version": "1.1.1",
"version": "1.1.2",
"from": "depd@>=1.1.0 <1.2.0",
"resolved": "https://registry.npmjs.org/depd/-/depd-1.1.1.tgz"
"resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz"
},
"destroy": {
"version": "1.0.4",
@ -303,6 +298,11 @@
"from": "dot@>=1.0.2 <1.1.0",
"resolved": "https://registry.npmjs.org/dot/-/dot-1.0.3.tgz"
},
"double-ended-queue": {
"version": "2.1.0-0",
"from": "double-ended-queue@>=2.1.0-0 <3.0.0",
"resolved": "https://registry.npmjs.org/double-ended-queue/-/double-ended-queue-2.1.0-0.tgz"
},
"dtrace-provider": {
"version": "0.6.0",
"from": "dtrace-provider@>=0.6.0 <0.7.0",
@ -383,9 +383,9 @@
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.0.0.tgz"
},
"forwarded": {
"version": "0.1.0",
"version": "0.1.2",
"from": "forwarded@>=0.1.0 <0.2.0",
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.0.tgz"
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz"
},
"fresh": {
"version": "0.3.0",
@ -511,9 +511,9 @@
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz"
},
"is-my-json-valid": {
"version": "2.16.0",
"version": "2.17.1",
"from": "is-my-json-valid@>=2.12.4 <3.0.0",
"resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.16.0.tgz"
"resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.17.1.tgz"
},
"is-property": {
"version": "1.0.2",
@ -636,14 +636,14 @@
"resolved": "https://registry.npmjs.org/mime/-/mime-1.3.4.tgz"
},
"mime-db": {
"version": "1.29.0",
"from": "mime-db@>=1.29.0 <1.30.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.29.0.tgz"
"version": "1.30.0",
"from": "mime-db@>=1.30.0 <1.31.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.30.0.tgz"
},
"mime-types": {
"version": "2.1.16",
"version": "2.1.17",
"from": "mime-types@>=2.1.6 <2.2.0",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.16.tgz"
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.17.tgz"
},
"minimatch": {
"version": "3.0.4",
@ -661,9 +661,9 @@
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz"
},
"moment": {
"version": "2.18.1",
"version": "2.20.1",
"from": "moment@>=2.10.6 <3.0.0",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.18.1.tgz",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.20.1.tgz",
"optional": true
},
"ms": {
@ -690,9 +690,9 @@
"optional": true
},
"nan": {
"version": "2.6.2",
"version": "2.8.0",
"from": "nan@>=2.0.8 <3.0.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.6.2.tgz"
"resolved": "https://registry.npmjs.org/nan/-/nan-2.8.0.tgz"
},
"ncp": {
"version": "2.0.0",
@ -778,9 +778,9 @@
"resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz"
},
"parseurl": {
"version": "1.3.1",
"version": "1.3.2",
"from": "parseurl@>=1.3.1 <1.4.0",
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.1.tgz"
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz"
},
"path-exists": {
"version": "2.1.0",
@ -812,15 +812,20 @@
"from": "pg-connection-string@0.1.3",
"resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-0.1.3.tgz"
},
"pg-int8": {
"version": "1.0.1",
"from": "pg-int8@1.0.1",
"resolved": "https://registry.npmjs.org/pg-int8/-/pg-int8-1.0.1.tgz"
},
"pg-pool": {
"version": "1.8.0",
"from": "pg-pool@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-1.8.0.tgz"
},
"pg-types": {
"version": "1.12.0",
"version": "1.13.0",
"from": "pg-types@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/pg-types/-/pg-types-1.12.0.tgz"
"resolved": "https://registry.npmjs.org/pg-types/-/pg-types-1.13.0.tgz"
},
"pgpass": {
"version": "1.0.2",
@ -908,14 +913,19 @@
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz"
},
"redis": {
"version": "0.12.1",
"from": "redis@>=0.12.1 <0.13.0",
"resolved": "https://registry.npmjs.org/redis/-/redis-0.12.1.tgz"
"version": "2.8.0",
"from": "redis@>=2.8.0 <3.0.0",
"resolved": "https://registry.npmjs.org/redis/-/redis-2.8.0.tgz"
},
"redis-commands": {
"version": "1.3.1",
"from": "redis-commands@>=1.2.0 <2.0.0",
"resolved": "https://registry.npmjs.org/redis-commands/-/redis-commands-1.3.1.tgz"
},
"redis-mpool": {
"version": "0.4.1",
"from": "redis-mpool@0.4.1",
"resolved": "https://registry.npmjs.org/redis-mpool/-/redis-mpool-0.4.1.tgz",
"version": "0.5.0",
"from": "redis-mpool@0.5.0",
"resolved": "https://registry.npmjs.org/redis-mpool/-/redis-mpool-0.5.0.tgz",
"dependencies": {
"generic-pool": {
"version": "2.1.1",
@ -924,6 +934,11 @@
}
}
},
"redis-parser": {
"version": "2.6.0",
"from": "redis-parser@>=2.6.0 <3.0.0",
"resolved": "https://registry.npmjs.org/redis-parser/-/redis-parser-2.6.0.tgz"
},
"redlock": {
"version": "2.0.1",
"from": "redlock@2.0.1",
@ -1086,9 +1101,9 @@
"resolved": "https://registry.npmjs.org/topojson/-/topojson-0.0.8.tgz"
},
"tough-cookie": {
"version": "2.3.2",
"version": "2.3.3",
"from": "tough-cookie@>=2.3.0 <2.4.0",
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.2.tgz"
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.3.tgz"
},
"tunnel-agent": {
"version": "0.4.3",

View File

@ -21,7 +21,7 @@
"bunyan": "1.8.1",
"cartodb-psql": "0.10.1",
"cartodb-query-tables": "0.2.0",
"cartodb-redis": "0.14.0",
"cartodb-redis": "0.15.0",
"debug": "2.2.0",
"express": "~4.13.3",
"log4js": "cartodb/log4js-node#cdb",
@ -32,7 +32,7 @@
"oauth-client": "0.3.0",
"qs": "~6.2.1",
"queue-async": "~1.0.7",
"redis-mpool": "0.4.1",
"redis-mpool": "0.5.0",
"redlock": "2.0.1",
"request": "~2.75.0",
"step": "~0.0.5",

View File

@ -58,7 +58,7 @@ describe('job backend', function() {
delete job.data.job_id;
jobBackend.create(job, function (err) {
jobBackend.create(job.data, function (err) {
assert.ok(err);
assert.equal(err.name, 'NotFoundError');
assert.equal(err.message, 'Job with id undefined not found');

View File

@ -27,7 +27,8 @@ describe('job publisher', function() {
client.on('message', function (channel, host) {
assert.equal(host, HOST);
assert.equal(channel, Channel.NAME) ;
assert.equal(channel, Channel.NAME);
client.unsubscribe(Channel.NAME);
done();
});