Skip to content

Commit

Permalink
delete flush fix
Browse files Browse the repository at this point in the history
  • Loading branch information
max-ostapenko committed Dec 10, 2024
1 parent 499795d commit e8811ac
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion infra/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ curl -X POST http://localhost:8080/ \
"job": {
"jobConfiguration": {
"query": {
"query": "/* {\"dataform_trigger\": \"report_cwv_tech_complete\", \"date\": \"2024-10-01\", \"name\": \"adoption\", \"type\": \"report\"} *\/"
"query": "/* {\"dataform_trigger\": \"report_cwv_tech_complete\", \"date\": \"2024-11-01\", \"name\": \"adoption\", \"type\": \"report\"} *\/"
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions infra/dataform-export/firestore.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ export class FirestoreBatch {

snapshot.forEach(async (doc) => {
this.currentBatch.push(doc)
totalDocsDeleted++

if (this.currentBatch.length >= this.batchSize) {
this.queueBatch('delete')
Expand All @@ -99,12 +98,13 @@ export class FirestoreBatch {
if (this.batchPromises.length >= this.maxConcurrentBatches) {
await this.commitBatches()
}
totalDocsDeleted++
})
await this.finalFlush('delete')

const duration = (Date.now() - startTime) / 1000
console.info(`Deletion complete. Total docs deleted: ${totalDocsDeleted}. Time: ${duration} seconds`)
}
await this.finalFlush('delete')

const duration = (Date.now() - startTime) / 1000
console.info(`Deletion complete. Total docs deleted: ${totalDocsDeleted}. Time: ${duration} seconds`)
}

/**
Expand Down

0 comments on commit e8811ac

Please sign in to comment.