From c93acdfc87f7e32496df0fe40d1b4365079242b7 Mon Sep 17 00:00:00 2001 From: John McLear Date: Wed, 9 Oct 2013 16:14:16 +0100 Subject: [PATCH 1/3] suggestion --- src/node/db/PadManager.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/node/db/PadManager.js b/src/node/db/PadManager.js index 7d546fc7..b869530f 100644 --- a/src/node/db/PadManager.js +++ b/src/node/db/PadManager.js @@ -85,7 +85,6 @@ var padList = { } }; //initialises the allknowing data structure -padList.init(); /** * An array of padId transformations. These represent changes in pad name policy over @@ -159,6 +158,11 @@ exports.getPad = function(id, text, callback) exports.listAllPads = function(callback) { + // console.warn("list all pads") + if(!padList.list.length == 0){ // If we haven't populated the padList.list yet + // console.warn("pad list is empty, filling it"); + padList.init(); + } if(callback != null){ callback(null,{padIDs: padList.getPads()}); }else{ From 40a65bd41cba6a860736f9dbb58da0b766998418 Mon Sep 17 00:00:00 2001 From: John McLear Date: Wed, 9 Oct 2013 16:17:36 +0100 Subject: [PATCH 2/3] more warns --- src/node/db/PadManager.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/node/db/PadManager.js b/src/node/db/PadManager.js index b869530f..f1f7dbdc 100644 --- a/src/node/db/PadManager.js +++ b/src/node/db/PadManager.js @@ -37,6 +37,12 @@ var globalPads = { set: function (name, value) { this[':'+name] = value; + + if(!padList.list.length == 0){ // If we haven't populated the padList.list yet + console.warn("TEHB pad list is empty, filling it"); + padList.init(); + } + padList.addPad(name); }, remove: function (name) { delete this[':'+name]; } @@ -158,9 +164,9 @@ exports.getPad = function(id, text, callback) exports.listAllPads = function(callback) { - // console.warn("list all pads") + console.warn("list all pads RAA") if(!padList.list.length == 0){ // If we haven't populated the padList.list yet - // console.warn("pad list is empty, filling it"); + console.warn("pad list is empty, filling it asd asd "); padList.init(); } if(callback != null){ @@ -228,6 +234,10 @@ exports.isValidPadId = function(padId) * Removes the pad from database and unloads it. */ exports.removePad = function(padId){ + if(!padList.list.length == 0){ // If we haven't populated the padList.list yet + // console.warn("pad list is empty, filling it"); + padList.init(); + } db.remove("pad:"+padId); exports.unloadPad(padId); padList.removePad(padId); From 2992e3ea2b0115fd89e73075b811df897e7b0241 Mon Sep 17 00:00:00 2001 From: John McLear Date: Wed, 9 Oct 2013 16:34:50 +0100 Subject: [PATCH 3/3] clean up --- src/node/db/PadManager.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/node/db/PadManager.js b/src/node/db/PadManager.js index f1f7dbdc..120649a2 100644 --- a/src/node/db/PadManager.js +++ b/src/node/db/PadManager.js @@ -39,7 +39,6 @@ var globalPads = { this[':'+name] = value; if(!padList.list.length == 0){ // If we haven't populated the padList.list yet - console.warn("TEHB pad list is empty, filling it"); padList.init(); } @@ -164,9 +163,7 @@ exports.getPad = function(id, text, callback) exports.listAllPads = function(callback) { - console.warn("list all pads RAA") if(!padList.list.length == 0){ // If we haven't populated the padList.list yet - console.warn("pad list is empty, filling it asd asd "); padList.init(); } if(callback != null){ @@ -235,7 +232,6 @@ exports.isValidPadId = function(padId) */ exports.removePad = function(padId){ if(!padList.list.length == 0){ // If we haven't populated the padList.list yet - // console.warn("pad list is empty, filling it"); padList.init(); } db.remove("pad:"+padId);