From 0d92343d55cf35ef3f718ad7a07f0c8591759bc1 Mon Sep 17 00:00:00 2001 From: mntmn Date: Mon, 8 Jan 2018 12:41:12 +0100 Subject: [PATCH] fix redis mock incr() --- helpers/redis.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/helpers/redis.js b/helpers/redis.js index 610742c..9866ba4 100644 --- a/helpers/redis.js +++ b/helpers/redis.js @@ -1,11 +1,12 @@ 'use strict'; +// this is a mock version of the Redis API, +// emulating Redis if it is not available locally var notRedis = { state: {}, topics: {}, publish: function(topic, msg, cb) { - //console.log("[notredis] publish",topic,msg); if (!this.topics[topic]) { this.topics[topic] = { subscribers: [] @@ -43,7 +44,7 @@ var notRedis = { t.subscribers.push(handle); } - cb(null, handle, topics.length); + cb(null, topics.length); return handle; }, @@ -82,7 +83,7 @@ var notRedis = { incr: function(key, cb) { if (!this.state[key]) this.state[key] = 0; this.state[key]++; - cb(); + cb(null, this.state[key]); }, expire: function() {