Don't try to populate padlist on each req

This is an important fix, prolly wants merging into master ASAP.  

Before this fix each new pad request would re-populate the all pads object, this is a blocking procedure and slows down the loading to a point where it's almost useless :(

Testing didn't find this because our testing stack isn't populated with pad data :|  TLDR.  Our tests still suck, hard.
pull/1939/head
John McLear 2013-10-13 16:39:45 +01:00
parent 8c9e543b91
commit 680d9a2811
1 changed files with 3 additions and 3 deletions

View File

@ -38,7 +38,7 @@ var globalPads = {
{
this[':'+name] = value;
if(!padList.list.length == 0){ // If we haven't populated the padList.list yet
if(padList.list.length == 0){ // If we haven't populated the padList.list yet
padList.init();
}
@ -163,7 +163,7 @@ exports.getPad = function(id, text, callback)
exports.listAllPads = function(callback)
{
if(!padList.list.length == 0){ // If we haven't populated the padList.list yet
if(padList.list.length == 0){ // If we haven't populated the padList.list yet
padList.init();
}
if(callback != null){
@ -231,7 +231,7 @@ 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
if(padList.list.length == 0){ // If we haven't populated the padList.list yet
padList.init();
}
db.remove("pad:"+padId);