Skip to content

Commit

Permalink
Merge pull request #5380 from Countly/remove-crash
Browse files Browse the repository at this point in the history
Add run once option to crash removal script
  • Loading branch information
kanwarujjaval authored Jul 4, 2024
2 parents 816334d + a1998d6 commit 890c073
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions bin/scripts/data-cleanup/remove_old_crashes.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ const SERVER_URL = '';
const BATCH_LIMIT = 1000;
// format 'YYYY-MM-DD', crashes with last occurence older than this will be removed
const LAST_TIMESTAMP = '';
// if true, run one batch of deletion then exit
const RUN_ONCE = true;

const moment = require('moment-timezone');
const _ = require('underscore');
Expand Down Expand Up @@ -125,7 +127,7 @@ pluginManager.dbConnection().then(async(db) => {
uri: urlObj.href,
}));

while (requestOptions.length > 0) {
do {
const requestOption = requestOptions.shift();

if (DRY_RUN) {
Expand Down Expand Up @@ -161,7 +163,7 @@ pluginManager.dbConnection().then(async(db) => {
uri: urlObj.href,
}));
}
}
} while (requestOptions.length > 0 && !RUN_ONCE);

db.close();
});

0 comments on commit 890c073

Please sign in to comment.