mirror of
https://github.com/Permissionless-Software-Foundation/psf-memo.git
synced 2026-09-21 16:52:01 -07:00
Clean up acceptance LevelDB temp dirs
Each psf-memo-db acceptance scenario opened an isolated LevelDB directory but close() only closed the handles, so tmp/acceptance grew without bound (found at 961 dirs / 293 MB). Delete the scenario dir in close() and sweep tmp/acceptance at the start of the acceptance run. By specifier.
This commit is contained in:
@@ -33,7 +33,19 @@ function ensureAps () {
|
||||
'https://github.com/unclebob/Acceptance-Pipeline-Specification.git', apsDir])
|
||||
}
|
||||
|
||||
// Each scenario opens an isolated LevelDB directory under tmp/acceptance.
|
||||
// Remove leftovers from earlier runs (including pre-fix runs that leaked them)
|
||||
// so the directory cannot grow without bound.
|
||||
function cleanStaleWorlds () {
|
||||
try {
|
||||
fs.rmSync(path.join(root, 'tmp', 'acceptance'), { recursive: true, force: true })
|
||||
} catch (err) {
|
||||
// ignore cleanup errors
|
||||
}
|
||||
}
|
||||
|
||||
function main () {
|
||||
cleanStaleWorlds()
|
||||
ensureAps()
|
||||
|
||||
const features = fs
|
||||
|
||||
@@ -152,6 +152,13 @@ async function createWorld () {
|
||||
} catch (err) {
|
||||
// ignore close errors
|
||||
}
|
||||
// Each scenario opens an isolated LevelDB directory. Remove it here so
|
||||
// tmp/acceptance cannot grow without bound across runs.
|
||||
try {
|
||||
fs.rmSync(levelDir, { recursive: true, force: true })
|
||||
} catch (err) {
|
||||
// ignore cleanup errors
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user