Commit b5c177b
“graciegould”
fix: deduplicate concurrent downloads in resolveModelFile
When multiple concurrent calls to resolveModelFile target the same
model, each call independently starts a download via ipull. Multiple
ipull instances writing to the same .ipull temp file causes orphaned
FileHandle objects when the first download completes and renames the
file. On Node 22+, garbage-collected FileHandles are a fatal error.
Add a module-level Map to track in-flight downloads by entrypoint
file path. When a concurrent call detects an existing download for
the same file, it cancels its own downloader and awaits the existing
promise instead of starting a duplicate download.
Closes #5691 parent 5a44506 commit b5c177b
1 file changed
Lines changed: 33 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
15 | 22 | | |
16 | 23 | | |
17 | 24 | | |
| |||
270 | 277 | | |
271 | 278 | | |
272 | 279 | | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
279 | 297 | | |
280 | | - | |
| 298 | + | |
| 299 | + | |
281 | 300 | | |
282 | | - | |
283 | | - | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
284 | 306 | | |
285 | | - | |
| 307 | + | |
| 308 | + | |
286 | 309 | | |
287 | 310 | | |
288 | 311 | | |
| |||
0 commit comments