-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
Closed
Description
The recursive rmdir() currently supports two options:
emfileWait- WhenEMFILE(and soonENFILE) is encountered, the operation is retried. The retry logic involves creating a series of timers, where the delay increases by 1ms untilemfileWaitis reached. This is only used in the asynchronous rimraf, and once it supportsENFILE, the name isn't really accurate anymore. This currently defaults to 1000.maxBusyTries- This option is used whenEBUSY,ENOTEMPTY, orEPERMis encountered. This retry logic involves creating a series ofmaxBusyTriestimers, where the delay increases by 100ms. This is also only used in the asynchronous rimraf. This currently defaults to 3.
I'm proposing the following changes (note that rimraf is still experimental):
- Rename
maxBusyTriestomaxRetriesand make the default 0. By making the default 0, I think we can start applying this to the synchronous rimraf. I think retries should be opt-in, particularly for synchronous operations, which can block the event loop for a while. I also think that the async and sync versions should have consistent handling of retry logic. - Remove
emfileWaitcompletely, and use the same retry logic consistently. - Introduce a
retryDelayoption that specifies the amount of time to wait between retry attempts.
sindresorhus and Trott
Metadata
Metadata
Assignees
Labels
No labels