fix proxy state loading bug when key not present

This commit is contained in:
Jerry Brady 2014-04-11 13:26:42 +00:00
parent b9891c8624
commit 5f6b09a877
1 changed files with 3 additions and 7 deletions

View File

@ -209,16 +209,12 @@ module.exports = function(logger){
var redisClient = redis.createClient(6379, "localhost") var redisClient = redis.createClient(6379, "localhost")
redisClient.on('ready', function(){ redisClient.on('ready', function(){
redisClient.hgetall("proxyState", function(error, obj) { redisClient.hgetall("proxyState", function(error, obj) {
if (error) { if (error || obj == null) {
proxyState = {};
logger.debug(logSystem, logComponent, logSubCat, 'No last proxy state found in redis'); logger.debug(logSystem, logComponent, logSubCat, 'No last proxy state found in redis');
} }
else { else {
if (obj != null) proxyState = obj;
{ logger.debug(logSystem, logComponent, logSubCat, 'Last proxy state loaded from redis');
proxyState = obj;
logger.debug(logSystem, logComponent, logSubCat, 'Last proxy state loaded from redis');
}
} }
// //