MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / growWalThenSigkill

Function growWalThenSigkill

__tests__/wal-heal.test.ts:59–76  ·  view source on GitHub ↗
(dbPath: string, targetBytes: number)

Source from the content-addressed store, hash-verified

57`;
58
59async function growWalThenSigkill(dbPath: string, targetBytes: number): Promise<void> {
60 const child = spawn(process.execPath, ['-e', WRITER_SOURCE, dbPath, String(targetBytes)], {
61 stdio: ['ignore', 'pipe', 'inherit'],
62 // Keep the child's cwd off the temp dir (Windows EPERM-on-cleanup quirk).
63 cwd: os.tmpdir(),
64 });
65 await new Promise<void>((resolve, reject) => {
66 let out = '';
67 child.stdout!.on('data', (d) => {
68 out += String(d);
69 if (out.includes('READY')) resolve();
70 });
71 child.on('exit', (code) => reject(new Error(`writer exited early (code ${code})`)));
72 setTimeout(() => reject(new Error('timed out growing the WAL')), 90_000);
73 });
74 child.kill('SIGKILL');
75 await new Promise((r) => child.on('exit', r));
76}
77
78describe('WAL heal after killed sessions (#1431)', () => {
79 let dir: string;

Callers 1

wal-heal.test.tsFile · 0.85

Calls 2

onMethod · 0.65
resolveFunction · 0.50

Tested by

no test coverage detected