You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 11, 2021. It is now read-only.
It would be great if the reason the lock couldn't be acquired could be included in the error message. I thought there was something wrong with my implementation because I would intermittently see Error: EEXIST: file already exists, open 'xxx' in my logs. After extensive debugging, I realised it was working as designed, it was just timing out after the wait has expired.
I added the following workaround code:
letwait=60e3;letbefore=newDate();try{awaitlock(lockFilePath,{ wait });}catch(err){letelapsed=newDate()-before;if(err.code==='EEXIST'&&elapsed>=wait){err=newError(`\`${lock.name}\` failed to acquire lock after ${elapsed}ms. ${err.message}`);}throwerr;}
It would be great if we could include all this context as to why it failed into the error message.