Improve file waiting mechanism in EmulatorFileSystem#68
Merged
arianrhodsandlot merged 1 commit intoarianrhodsandlot:mainfrom Dec 16, 2025
Merged
Improve file waiting mechanism in EmulatorFileSystem#68arianrhodsandlot merged 1 commit intoarianrhodsandlot:mainfrom
arianrhodsandlot merged 1 commit intoarianrhodsandlot:mainfrom
Conversation
## Improve file waiting mechanism in EmulatorFileSystemThis PR enhances the `waitForFile` method in the `EmulatorFileSystem` class to be more efficient and reliable when waiting for emulator files to finish writing.### Changes- **Added `stat` method**: New helper method that safely wraps `FS.stat()` with error handling- **Refactored `waitForFile` logic**: - Replaced expensive buffer content reading with lightweight file size checking - Increased max retries from 30 to 120 for better handling of slow file systems - Adjusted timing from max 1000ms to max 500ms delays for more responsive checking - Simplified completion detection to wait for file size stabilization### Benefits- **Performance**: Significantly faster file polling using `stat()` instead of full content reads- **Memory**: Reduced memory usage by eliminating buffer storage during polling- **Reliability**: More robust file completion detection through size comparison- **Compatibility**: Better handling of various file system speeds and file sizes
Contributor
Author
|
This has been discussed in #64 |
Owner
|
Thanks! |
Contributor
Author
|
Thanks for merging this. |
Owner
|
I'm not quite good at this too and here's a general guide I used to learn from: https://opensource.guide/finding-users/ . This can be the hardest part of an open source project, way more difficult than writing code. And there's a significant element of luck involved. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Improve file waiting mechanism in EmulatorFileSystem
This PR enhances the
waitForFilemethod in theEmulatorFileSystemclass to be more efficient and reliable when waiting for emulator files to finish writing.Changes
statmethod: New helper method that safely wrapsFS.stat()with error handlingwaitForFilelogic: - Replaced expensive buffer content reading with lightweight file size checkingBenefits
stat()instead of full content reads