isaacs / node-graceful-fs

fs with incremental backoff on EMFILE
ISC License
1.27k stars 147 forks source link

Fix copyFile wrapper when retry() hits EMFILE again #209

Closed mbargiel closed 3 years ago

mbargiel commented 3 years ago

The copyFile wrapper introduced in #199 does not follow the same pattern as the other wrappers, and enqueued the wrapped copyFile rather than the wrapper function, which means that a subsequent EMFILE or ENFILE error occurring when retrying the copyFile would fail and bubble the EMFILE or ENFILE to the calling code rather than enqueue again. This fix applies the same pattern by introducing go$copyFile and enqueueing it rather than fs$copyFile.

Fixes #208.

All tests pass and coverage goes up a bit (probably just because the new lines of test code are covered). I couldn't find tests that validate the EMFILE retry logic for the fs function wrappers (at least not for copyFile).

mbargiel commented 3 years ago

I don't understand the CI failures. The Npm run test step has identical outputs between failed and successful builds, unless it's failing because it takes a bit longer on some test builds. ⁉️

EDIT: Ah, I see it's not an abnormal situation. 😌