db/GroupManager: move inner function on top. No functional change

This is to make easier on the eye the next change.
This commit is contained in:
muxator 2018-08-29 02:36:25 +02:00
parent 6af419a88e
commit c85bcf0614

View file

@ -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);
});
}
});
}