Merge pull request #22019 from overleaf/jpa-cleanup

[history-v1] back_fill_file_hash: cleanup BUFFER_DIR when done

GitOrigin-RevId: 6413292bbe8cca470919b740d7e2b45fc5e7d824
This commit is contained in:
Jakob Ackermann 2024-11-20 16:45:36 +01:00 committed by Copybot
parent 71112d2fdc
commit 44e0428496
2 changed files with 11 additions and 0 deletions

View file

@ -1101,6 +1101,13 @@ try {
await main()
} finally {
printStats()
try {
// Perform non-recursive removal of the BUFFER_DIR. Individual files
// should get removed in parallel as part of batch processing.
await fs.promises.rmdir(BUFFER_DIR)
} catch (err) {
console.error(`cleanup of BUFFER_DIR=${BUFFER_DIR} failed`, err)
}
}
let code = 0

View file

@ -1,3 +1,4 @@
import fs from 'node:fs'
import Crypto from 'node:crypto'
import Stream from 'node:stream'
import { setTimeout } from 'node:timers/promises'
@ -511,6 +512,9 @@ describe('back_fill_file_hash script', function () {
}
result = { stdout, stderr, status: code }
}
expect((await fs.promises.readdir('/tmp')).join(';')).to.not.match(
/back_fill_file_hash/
)
const extraStatsKeys = [
'eventLoop',
'readFromGCSThroughputMiBPerSecond',