Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

W-17915544 fix: don't lock directory #1169

Merged
merged 1 commit into from
Feb 27, 2025
Merged

W-17915544 fix: don't lock directory #1169

merged 1 commit into from
Feb 27, 2025

Conversation

mshanemc
Copy link
Contributor

What does this PR do?
whoever originally wrote this (jk, it's me!) locked the parent directory (ex: .sfdx) when creating files there (ex: auth files)

works fine on my machine, might delay things a tiny bit if I'm doing many parallelized things.

cliaas under load from thousands of sandboxes might wait a long time to get to create an auth file, and annoy users or timeout

proper-lockfile https://www.npmjs.com/package/proper-lockfile has the option to not try to resolve the file (by default it does, using realpath option default true)

This change means it puts a lock file in the target folder (ex: sfdx) and if someone else tries to create the same file (ex: auth file) they have to wait for my lock to expire, just like they would for a file that exists.

perf bonus: saves a bit of time for CLI doing fs.existsSync

[realpath option was there to resolve symlinks. None of our auth files are symlinks. If they're in a symlinked dir, it works as expected]

What issues does this PR fix or reference?
@W-17915544@

@mshanemc mshanemc requested a review from a team as a code owner February 27, 2025 12:49
@mshanemc mshanemc changed the title fix: don't lock directory W-17915544 fix: don't lock directory Feb 27, 2025
@mshanemc mshanemc merged commit c569237 into main Feb 27, 2025
146 of 151 checks passed
@mshanemc mshanemc deleted the sm/dont-lock-directory branch February 27, 2025 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants