Skip to content

Don’t try renaming saved index if it doesn’t exist #221

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

Closed
wants to merge 1 commit into from

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Oct 14, 2024

We were calling llvm::sys::fs::rename with the assumption that it fails immediately if savedPathBuf does not exist. But on Windows, the rename is retried 200 times with 10ms delay = for 2s, causing the creation of a new indexstore-db take 2s longer than necessary on Windows.

// Retry this a few times to defeat badly behaved file system scanners.
for (unsigned Retry = 0; Retry != 200; ++Retry) {
if (Retry != 0)
::Sleep(10);

We were calling `llvm::sys::fs::rename` with the assumption that it fails immediately if `savedPathBuf` does not exist. But on Windows, the rename is retried 200 times with 10ms delay = for 2s, causing the creation of a new indexstore-db take 2s longer than necessary on Windows.

https://github.com/swiftlang/indexstore-db/blob/6120b53b1e8774ef4e2ad83438d4d94961331e72/lib/LLVMSupport/Support/Windows/Path.inc#L540-L543
@ahoppen ahoppen requested a review from bnbarham as a code owner October 14, 2024 22:13
@ahoppen
Copy link
Member Author

ahoppen commented Oct 14, 2024

@swift-ci Please test

@ahoppen
Copy link
Member Author

ahoppen commented Oct 15, 2024

Closing in favor of #222

@ahoppen ahoppen closed this Oct 15, 2024
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.

2 participants