Bug fix (forEech and promises...)
This commit is contained in:
parent
4502162a36
commit
8a63cc07f4
|
@ -20,7 +20,7 @@ export { state };
|
||||||
|
|
||||||
export const watchDbLegacy = async () => {
|
export const watchDbLegacy = async () => {
|
||||||
createRoot(async (dispose) => {
|
createRoot(async (dispose) => {
|
||||||
console.log({ caller: 'watchDbLegacy' });
|
console.log({ caller: 'watchDbLegacy / start' });
|
||||||
|
|
||||||
db = globalThis.db;
|
db = globalThis.db;
|
||||||
localDb = globalThis.localDb;
|
localDb = globalThis.localDb;
|
||||||
|
@ -189,9 +189,9 @@ export const watchDbLegacy = async () => {
|
||||||
deletedDocs,
|
deletedDocs,
|
||||||
state: state(),
|
state: state(),
|
||||||
});
|
});
|
||||||
|
let i = 0;
|
||||||
deletedDocs.forEach(async (doc) => {
|
for (const doc of deletedDocs) {
|
||||||
await sleep(500);
|
await sleep(50);
|
||||||
try {
|
try {
|
||||||
await db.purge(doc.id, doc.rev);
|
await db.purge(doc.id, doc.rev);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
@ -201,7 +201,16 @@ export const watchDbLegacy = async () => {
|
||||||
err,
|
err,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
i = i + 1;
|
||||||
|
if (i % 10 === 0) {
|
||||||
|
console.log({
|
||||||
|
caller: 'watchDbLegacy / purge',
|
||||||
|
nbDeletedDocs: i,
|
||||||
|
nbDocsToDelete: deletedDocs.length,
|
||||||
|
doc,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
await sleep(60000);
|
await sleep(60000);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue