Skip to content

Improve file waiting mechanism in EmulatorFileSystem#68

Merged
arianrhodsandlot merged 1 commit intoarianrhodsandlot:mainfrom
muditjuneja:main
Dec 16, 2025
Merged

Improve file waiting mechanism in EmulatorFileSystem#68
arianrhodsandlot merged 1 commit intoarianrhodsandlot:mainfrom
muditjuneja:main

Conversation

@muditjuneja
Copy link
Contributor

Improve file waiting mechanism in EmulatorFileSystem

This 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

## 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
@muditjuneja
Copy link
Contributor Author

This has been discussed in #64
@arianrhodsandlot could you review this?

@arianrhodsandlot arianrhodsandlot merged commit 04ac430 into arianrhodsandlot:main Dec 16, 2025
4 checks passed
@arianrhodsandlot
Copy link
Owner

Thanks!

@muditjuneja
Copy link
Contributor Author

Thanks for merging this.
I wonder how can I get some reach for Koin Player? this would help me find contributors as well. How did you do this?

@arianrhodsandlot
Copy link
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.

@arianrhodsandlot arianrhodsandlot added the enhancement New feature or request label Jan 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants