mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-23 17:06:16 -04:00
Merge pull request #2602 from devoidfury/fix/import-large-etherpad
fix large etherpad import, fixes #2524
This commit is contained in:
commit
4a70837de9
2 changed files with 21 additions and 36 deletions
|
@ -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);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue