mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-04 02:00:21 +00:00
test: harden threaded shared-worker suites
This commit is contained in:
@@ -177,6 +177,7 @@ async function releaseHeldLock(
|
||||
*/
|
||||
function releaseAllLocksSync(): void {
|
||||
for (const [sessionFile, held] of HELD_LOCKS) {
|
||||
void held.handle.close().catch(() => undefined);
|
||||
try {
|
||||
fsSync.rmSync(held.lockPath, { force: true });
|
||||
} catch {
|
||||
@@ -576,6 +577,14 @@ export const __testing = {
|
||||
runLockWatchdogCheck,
|
||||
};
|
||||
|
||||
export async function drainSessionWriteLockStateForTest(): Promise<void> {
|
||||
for (const [sessionFile, held] of Array.from(HELD_LOCKS.entries())) {
|
||||
await releaseHeldLock(sessionFile, held, { force: true }).catch(() => undefined);
|
||||
}
|
||||
stopWatchdogTimer();
|
||||
unregisterCleanupHandlers();
|
||||
}
|
||||
|
||||
export function resetSessionWriteLockStateForTest(): void {
|
||||
releaseAllLocksSync();
|
||||
stopWatchdogTimer();
|
||||
|
||||
Reference in New Issue
Block a user