diff --git a/src/db-admin/health-legacy.ts b/src/db-admin/health-legacy.ts index 111654d..b7fd53a 100644 --- a/src/db-admin/health-legacy.ts +++ b/src/db-admin/health-legacy.ts @@ -20,7 +20,7 @@ export { state }; export const watchDbLegacy = async () => { createRoot(async (dispose) => { - console.log({ caller: 'watchDbLegacy' }); + console.log({ caller: 'watchDbLegacy / start' }); db = globalThis.db; localDb = globalThis.localDb; @@ -189,9 +189,9 @@ export const watchDbLegacy = async () => { deletedDocs, state: state(), }); - - deletedDocs.forEach(async (doc) => { - await sleep(500); + let i = 0; + for (const doc of deletedDocs) { + await sleep(50); try { await db.purge(doc.id, doc.rev); } catch (err) { @@ -201,7 +201,16 @@ export const watchDbLegacy = async () => { err, }); } - }); + i = i + 1; + if (i % 10 === 0) { + console.log({ + caller: 'watchDbLegacy / purge', + nbDeletedDocs: i, + nbDocsToDelete: deletedDocs.length, + doc, + }); + } + } } await sleep(60000); }