Skip to content
This repository has been archived by the owner on Oct 26, 2024. It is now read-only.

Commit

Permalink
Try to run recursiveDelete in parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
HugoGresse committed Apr 2, 2024
1 parent 7e9ff29 commit 2c6c210
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions scripts/openplanner/import-speakers-sessions-schedule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,13 @@ async function deleteCollection(collectionPath: string, batchSize: number = 100)
const query = collectionRef.orderBy('__name__').limit(batchSize);
const snapshot = await query.get();

console.log("Deleting collection", collectionPath, snapshot.size, "documents");

snapshot.docs.forEach((doc) => {
console.log('Deleting document ? ', doc.ref.path);
doc.ref.delete();
})

await runInParallel(snapshot.docs, 10, async (doc) => {
console.log('Deleting document', doc.ref.path);
await firestore.recursiveDelete(doc.ref);
Expand Down

0 comments on commit 2c6c210

Please sign in to comment.