From 5c915062e12f8c08e0ccb23320537bc127baa022 Mon Sep 17 00:00:00 2001 From: Claas Augner Date: Fri, 9 Mar 2018 14:02:22 +0100 Subject: [PATCH] checkAllPads: Increase performance/resilience Performance: Don't preload pads. Check for pool only once per pad. Resilience: Handle missing revision. --- bin/checkAllPads.js | 151 +++++++++++++++++++++++--------------------- 1 file changed, 79 insertions(+), 72 deletions(-) diff --git a/bin/checkAllPads.js b/bin/checkAllPads.js index 1657ba794..90cb15276 100644 --- a/bin/checkAllPads.js +++ b/bin/checkAllPads.js @@ -1,5 +1,5 @@ /* - This is a debug tool. It checks all revisions of all pads for data corruption + This is a debug tool. It checks all revisions for data corruption */ if(process.argv.length != 2) @@ -35,96 +35,103 @@ async.series([ padManager.listAllPads(function(err, res) { - var padIds = res.padIDs; - pads = []; - async.forEach(padIds, function(padId, callback) { - padManager.getPad(padId, function(err, pad) { - pads.push(pad); - callback(err); - }) - }, callback); + padIds = res.padIDs; + callback(err); }); }, function (callback) { - async.forEach(pads, function(pad, callback) + async.forEach(padIds, function(padId, callback) { - //create an array with key kevisions - //key revisions always save the full pad atext - var head = pad.getHeadRevisionNumber(); - var keyRevisions = []; - for(var i=0;i