Commit 8e18cb1
authored
Improve file waiting mechanism in EmulatorFileSystem
## 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 sizes1 parent 74659f0 commit 8e18cb1
1 file changed
+20
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
64 | 73 | | |
65 | 74 | | |
66 | 75 | | |
| |||
69 | 78 | | |
70 | 79 | | |
71 | 80 | | |
72 | | - | |
73 | | - | |
| 81 | + | |
| 82 | + | |
74 | 83 | | |
75 | 84 | | |
76 | 85 | | |
77 | | - | |
| 86 | + | |
78 | 87 | | |
79 | 88 | | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
84 | 94 | | |
85 | | - | |
86 | | - | |
87 | | - | |
| 95 | + | |
88 | 96 | | |
89 | 97 | | |
90 | 98 | | |
91 | | - | |
| 99 | + | |
92 | 100 | | |
93 | 101 | | |
94 | | - | |
| 102 | + | |
95 | 103 | | |
96 | 104 | | |
97 | 105 | | |
| |||
0 commit comments