Skip to content

Commit

Permalink
fix mock db uploads
Browse files Browse the repository at this point in the history
  • Loading branch information
au5ton committed Feb 25, 2023
1 parent 5eb1d0e commit 30c1ce3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 21 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ jobs:
make_mock_database:
name: Build local copy of database
runs-on: self-hosted
runs-on: ubuntu-latest
needs: [ build_full ]
defaults:
run:
Expand All @@ -179,7 +179,7 @@ jobs:
- name: Compress mock database
id: makemockdatabase
run: |
tar -czvf tmp/database.tar.gz -C tmp/firebaseFS/ $(ls tmp/firebaseFS/)
tar -czf tmp/database.tar.gz -C tmp/firebaseFS/ $(ls tmp/firebaseFS/)
echo "tarloc=tmp/database.tar.gz" >> $GITHUB_OUTPUT
- name: Upload Release Asset (Mock Database)
id: upload-release-asset-mockdb
Expand Down
21 changes: 2 additions & 19 deletions mock-database/src/createMockDatabase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,39 +27,22 @@ for (let file of files.filter(e => e.split('/').reverse()[0].startsWith(`patch-0
}

// Do `records.csv`
let pbar = terminal.progressBar({
title: 'Processing records.csv:',
eta: true,
percent: true
})
for (let i = 0; i < records.length; i++) {
await whenUploadQueueAdded(records[i]);
//console.log(`Processed client-side: ${i+1} of ${records.length} (${((i+1)/records.length*100).toFixed(1)}%)`)
pbar.update(i/records.length)
console.log(`Processed record: ${i+1} of ${records.length} (${((i+1)/records.length*100).toFixed(1)}%)`)
}
pbar.stop()
console.log(`Finished processing records (${records.length} processed)`)

// Do remaining patchfiles
let tally = 0
const TOTAL_PATCH_FILES_AFTER_0 = files.length - files.filter(e => e.split('/').reverse()[0].startsWith(`patch-0`)).length;
pbar = terminal.progressBar({
title: 'Processing Patch files:',
eta: true,
percent: true
})
for(let i = 1; i <= maxFilePhase; i++) {
console.log(`phase ${i} queue starting...`);
console.time(`phase ${i} time`);
const filesForCurrentPhase = files.filter(e => e.split('/').reverse()[0].startsWith(`patch-${i}`));

for(let file of filesForCurrentPhase) {
await processPatchfile(file)
tally += 1;
pbar.update(tally/TOTAL_PATCH_FILES_AFTER_0)
}

console.log(`phase ${i} queue done!`);
console.timeEnd(`phase ${i} time`);
}
pbar.stop()
}

0 comments on commit 30c1ce3

Please sign in to comment.