MCPcopy Create free account
hub / github.com/code-pushup/cli / cleanup

Method cleanup

packages/utils/src/lib/wal-sharded.ts:398–414  ·  view source on GitHub ↗

* Cleanup shard files by removing them from disk. * Coordinator-only: throws error if not coordinator to prevent race conditions. * Idempotent: returns early if already cleaned.

()

Source from the content-addressed store, hash-verified

396 * Idempotent: returns early if already cleaned.
397 */
398 cleanup() {
399 if (!this.isCoordinator()) {
400 throw new Error('cleanup() can only be called by coordinator');
401 }
402
403 if (this.#state === 'cleaned') {
404 return;
405 }
406
407 this.shardFiles()
408 .filter(f => fs.existsSync(f))
409 .forEach(f => {
410 fs.unlinkSync(f);
411 });
412
413 this.#state = 'cleaned';
414 }
415
416 get stats() {
417 // When finalized, count all shard files from filesystem (for multi-process scenarios)

Calls 2

isCoordinatorMethod · 0.95
shardFilesMethod · 0.95

Tested by

no test coverage detected