From b7f55882d10bb69c945ebd0cb89bcc6f1d48b9da Mon Sep 17 00:00:00 2001 From: mshanemc Date: Wed, 15 Nov 2023 14:34:56 -0600 Subject: [PATCH] fix: no retries on sync lock --- src/util/fileLocking.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/util/fileLocking.ts b/src/util/fileLocking.ts index 0a6efb6277..db955221b0 100644 --- a/src/util/fileLocking.ts +++ b/src/util/fileLocking.ts @@ -9,7 +9,7 @@ import { dirname } from 'node:path'; import { lock, lockSync } from 'proper-lockfile'; import { SfError } from '../sfError'; import { Logger } from '../logger/logger'; -import { lockRetryOptions } from './lockRetryOptions'; +import { lockOptions, lockRetryOptions } from './lockRetryOptions'; type LockInitResponse = { writeAndUnlock: (data: string) => Promise; unlock: () => Promise }; type LockInitSyncResponse = { writeAndUnlock: (data: string) => void; unlock: () => void }; @@ -74,10 +74,10 @@ export const lockInitSync = (filePath: string): LockInitSyncResponse => { const [unlock] = fs.existsSync(filePath) ? // if the file exists, wait for it to be unlocked - [lockSync(filePath, lockRetryOptions)] + [lockSync(filePath, lockOptions)] : // lock the entire directory to keep others from trying to create the file while we are [ - lockSync(dirname(filePath), lockRetryOptions), + lockSync(dirname(filePath), lockOptions), Logger.childFromRoot('fileLocking.lockInit').debug( `No file found at ${filePath}. Write will create it. Locking the entire directory until file is written.` ),