From eea6170f9c691eac101dcb8da5669352dd320938 Mon Sep 17 00:00:00 2001 From: williamlardier Date: Tue, 3 Dec 2024 18:58:53 +0100 Subject: [PATCH] Improve locking Issue: ZENKO-4941 --- tests/ctst/steps/utils/kubernetes.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/ctst/steps/utils/kubernetes.ts b/tests/ctst/steps/utils/kubernetes.ts index 3f9c9520d..2f0c5a57b 100644 --- a/tests/ctst/steps/utils/kubernetes.ts +++ b/tests/ctst/steps/utils/kubernetes.ts @@ -90,8 +90,8 @@ export async function createJobAndWaitForCompletion( } try { - // Acquire lock on the file - releaseLock = await lockFile.lock(lockFilePath, { stale: 600000 }); + // Acquire lock on the file with 1s delay and 10 minutes timeout + releaseLock = await lockFile.lock(lockFilePath, { stale: 1000, retries: 600 }); world.logger.debug(`Acquired lock for job: ${jobName}`); // Read the cron job and prepare the job spec @@ -153,7 +153,6 @@ export async function createJobAndWaitForCompletion( // Ensure the lock is released if (releaseLock) { await releaseLock(); - fs.unlinkSync(lockFilePath); world.logger.debug(`Released lock for job: ${jobName}`); } }