Breaking after 1000 purges.

This commit is contained in:
Eric van der Vlist 2023-02-13 10:11:46 +01:00
parent 19aaaba3f8
commit 01554e3383
1 changed files with 5 additions and 3 deletions

View File

@ -239,6 +239,7 @@ export const watchDbLegacy = async () => {
const deletedDocs = await getDeletedDocs();
let i = 0;
if (deletedDocs.length > 0) {
console.log({
caller: 'watchDbLegacy / purge',
@ -248,7 +249,6 @@ export const watchDbLegacy = async () => {
deletedDocs,
state: state(),
});
let i = 0;
for (const doc of deletedDocs) {
await sleep(10);
try {
@ -269,12 +269,14 @@ export const watchDbLegacy = async () => {
doc,
});
}
if (i === 10000) {
if (i === 20000) {
break;
}
}
}
await sleep(60000);
if (i !== deletedDocs.length) {
await sleep(60000);
}
}
});
};