Skip to content

Commit

Permalink
Merge pull request kentonv#12 from nashe/no_findkeys_export
Browse files Browse the repository at this point in the history
No findkeys during export
  • Loading branch information
JohnMcLear authored Apr 4, 2018
2 parents bb40aa0 + 806c920 commit 6388055
Showing 1 changed file with 10 additions and 17 deletions.
27 changes: 10 additions & 17 deletions src/node/utils/ExportEtherpad.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,18 @@ var ERR = require("async-stacktrace");
exports.getPadRaw = function(padId, callback){
async.waterfall([
function(cb){

// Get the Pad
db.findKeys("pad:"+padId, null, function(err,padcontent){
if(!err){
cb(err, padcontent);
}
})
db.get("pad:"+padId, cb);
},
function(padcontent,cb){
var records = ["pad:"+padId];
for (var i = 0; i <= padcontent.head; i++) {
records.push("pad:"+padId+":revs:" + i);
}

for (var i = 0; i <= padcontent.chatHead; i++) {
records.push("pad:"+padId+":chat:" + i);
}

// Get the Pad available content keys
db.findKeys("pad:"+padId+":*", null, function(err,records){
if(!err){
for (var key in padcontent) { records.push(padcontent[key]);}
cb(err, records);
}
})
},
function(records, cb){
var data = {};

async.forEachSeries(Object.keys(records), function(key, r){
Expand Down Expand Up @@ -69,7 +62,7 @@ exports.getPadRaw = function(padId, callback){
}
r(null); // callback;
});
}, function(err){
}, function(err){
cb(err, data);
})
}
Expand Down

0 comments on commit 6388055

Please sign in to comment.