From 81f94c56e057c2211edd0f0548e3dd2fc851b300 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Sat, 10 Aug 2013 16:15:58 -0400 Subject: [PATCH] using hgetall instead of hkeys+asynchget, simplifying meta.js, closes #157 --- src/meta.js | 29 ++++++----------------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/src/meta.js b/src/meta.js index 6786fb90e9..47ea895c4e 100644 --- a/src/meta.js +++ b/src/meta.js @@ -7,32 +7,15 @@ var utils = require('./../public/src/utils.js'), (function(Meta) { Meta.config = { get: function(callback) { - var config = {}; - - async.waterfall([ - function(next) { - RDB.hkeys('config', function(err, keys) { - next(err, keys); - }); - }, - function(keys, next) { - async.each(keys, function(key, next) { - RDB.hget('config', key, function(err, value) { - if (!err) { - config[key] = value; - } - - next(err); - }); - }, next); - } - ], function(err) { + RDB.hgetall('config', function(err, config) { if (!err) { config.status = 'ok'; callback(config); - } else callback({ - status: 'error' - }); + } else { + callback({ + status: 'error' + }); + } }); }, set: function(field, value, callback) {