From 891e747adb59b23faa48de0b16f5626ece1ea914 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Sat, 5 Mar 2016 19:12:41 -0500 Subject: [PATCH] fixes crash in analytics --- src/analytics.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/analytics.js b/src/analytics.js index c907d784a8..c1ede42eba 100644 --- a/src/analytics.js +++ b/src/analytics.js @@ -2,6 +2,7 @@ var cronJob = require('cron').CronJob; var async = require('async'); +var winston = require('winston'); var db = require('./database'); @@ -84,8 +85,10 @@ var db = require('./database'); if (Object.keys(counters).length > 0) { for(var key in counters) { - dbQueue.push(async.apply(db.sortedSetIncrBy, 'analytics:' + key, counters[key], today.getTime())); - delete counters[key]; + if (counters.hasOwnProperty(key)) { + dbQueue.push(async.apply(db.sortedSetIncrBy, 'analytics:' + key, counters[key], today.getTime())); + delete counters[key]; + } } }