summaryrefslogtreecommitdiff
path: root/src/node/utils
diff options
context:
space:
mode:
authorTom Hunkapiller <tom@furycodes.com>2015-04-11 11:55:36 -0500
committerTom Hunkapiller <tom@furycodes.com>2015-04-11 12:02:19 -0500
commita896d67e8c5aec468f70f740affef037d1994bce (patch)
tree5cb048d1e930f6587d4b54b6d6f1b988c767ff1e /src/node/utils
parent25092fcb903cf56ec33445ecde0aace412664d70 (diff)
downloadetherpad-lite-a896d67e8c5aec468f70f740affef037d1994bce.zip
make setPadRaw async; streamline .etherpad file import handling chain
Diffstat (limited to 'src/node/utils')
-rw-r--r--src/node/utils/ImportEtherpad.js13
1 files changed, 2 insertions, 11 deletions
diff --git a/src/node/utils/ImportEtherpad.js b/src/node/utils/ImportEtherpad.js
index 37863bff..bf1129cb 100644
--- a/src/node/utils/ImportEtherpad.js
+++ b/src/node/utils/ImportEtherpad.js
@@ -21,20 +21,11 @@ var db = require("../db/DB").db;
exports.setPadRaw = function(padId, records, callback){
records = JSON.parse(records);
- // !! HACK !!
- // If you have a really large pad it will cause a Maximum Range Stack crash
- // This is a temporary patch for that so things are kept stable.
- var recordCount = Object.keys(records).length;
- if(recordCount >= 50000){
- console.warn("Etherpad file is too large to import.. We need to fix this. See https://github.com/ether/etherpad-lite/issues/2524");
- return callback("tooLarge", false);
- }
-
async.eachSeries(Object.keys(records), function(key, cb){
var value = records[key]
if(!value){
- cb(); // null values are bad.
+ return setImmediate(cb);
}
// Author data
@@ -76,7 +67,7 @@ exports.setPadRaw = function(padId, records, callback){
// Write the value to the server
db.set(newKey, value);
- cb();
+ setImmediate(cb);
}, function(){
callback(null, true);
});