You need to sign in or sign up before continuing.
Commit 0d92343d authored by mntmn's avatar mntmn
Browse files

fix redis mock incr()

parent efb7970e
Showing with 4 additions and 3 deletions
+4 -3
'use strict'; 'use strict';
// this is a mock version of the Redis API,
// emulating Redis if it is not available locally
var notRedis = { var notRedis = {
state: {}, state: {},
topics: {}, topics: {},
publish: function(topic, msg, cb) { publish: function(topic, msg, cb) {
//console.log("[notredis] publish",topic,msg);
if (!this.topics[topic]) { if (!this.topics[topic]) {
this.topics[topic] = { this.topics[topic] = {
subscribers: [] subscribers: []
...@@ -43,7 +44,7 @@ var notRedis = { ...@@ -43,7 +44,7 @@ var notRedis = {
t.subscribers.push(handle); t.subscribers.push(handle);
} }
cb(null, handle, topics.length); cb(null, topics.length);
return handle; return handle;
}, },
...@@ -82,7 +83,7 @@ var notRedis = { ...@@ -82,7 +83,7 @@ var notRedis = {
incr: function(key, cb) { incr: function(key, cb) {
if (!this.state[key]) this.state[key] = 0; if (!this.state[key]) this.state[key] = 0;
this.state[key]++; this.state[key]++;
cb(); cb(null, this.state[key]);
}, },
expire: function() { expire: function() {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment