Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Since #12728, when a file lock can't be attained immediately, blocking flock waits in a loop an tries again until the lock becomes available.
As commented in #12728 (comment), the relatively tight loop with
Fiber.yield
can drive up CPU utilization.This patch lets the fiber sleep for 100ms. That amount isn't set in stone, but it's probably a good start. I've copied it from the Ruby implementation: https://github.com/ruby/ruby/blob/5404e2fd31736af3a7477f3ec67d3f07276485d6/file.c#L5283-L5308