Skip to content

Commit 405eb8e

Browse files
add error message if lock does not get released after some time
1 parent 96ce841 commit 405eb8e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/libraries/FileLock.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { InternalServerOptions } from "../../types";
44
export async function waitForLock(path: string, options: InternalServerOptions): Promise<void> {
55
const lockPath = `${path}.lock`
66
let retries = 0;
7+
78
do {
89
retries++;
910
try {
@@ -21,6 +22,8 @@ export async function waitForLock(path: string, options: InternalServerOptions):
2122
}
2223
}
2324
} while(retries <= options.lockRetries)
25+
26+
throw `lockRetries has been exceeded. Lock had not been released after ${options.lockRetryWait} * ${options.lockRetries} (${options.lockRetryWait * options.lockRetries}) milliseconds.`
2427
}
2528

2629
function setupMTimeEditor(lockPath: string): () => Promise<void> {

0 commit comments

Comments
 (0)