From c85bcf06140e9cd10f75be29f0395752a6c77a38 Mon Sep 17 00:00:00 2001 From: muxator Date: Wed, 29 Aug 2018 02:36:25 +0200 Subject: [PATCH] db/GroupManager: move inner function on top. No functional change This is to make easier on the eye the next change. --- src/node/db/GroupManager.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/node/db/GroupManager.js b/src/node/db/GroupManager.js index 82c14c39d..44bda74f2 100644 --- a/src/node/db/GroupManager.js +++ b/src/node/db/GroupManager.js @@ -213,7 +213,19 @@ exports.createGroupIfNotExistsFor = function(groupMapper, callback) //try to get a group for this mapper db.get("mapper2group:"+groupMapper, function(err, groupID) { - if(ERR(err, callback)) return; + function createGroupForMapper(cb) { + exports.createGroup(function(err, responseObj) + { + if(ERR(err, cb)) return; + + //create the mapper entry for this group + db.set("mapper2group:"+groupMapper, responseObj.groupID); + + cb(null, responseObj); + }); + } + + if(ERR(err, callback)) return; // there is a group for this mapper if(groupID) { @@ -229,18 +241,6 @@ exports.createGroupIfNotExistsFor = function(groupMapper, callback) else { createGroupForMapper(callback) } - - function createGroupForMapper(cb) { - exports.createGroup(function(err, responseObj) - { - if(ERR(err, cb)) return; - - //create the mapper entry for this group - db.set("mapper2group:"+groupMapper, responseObj.groupID); - - cb(null, responseObj); - }); - } }); }