Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Reset the EMFILE timeout value if no writes in 1s

  • Loading branch information...
commit 65ded5a2ba8ad756e2a6592c38e0670e2e95cb14 1 parent f872132
isaacs isaacs authored
Showing with 3 additions and 0 deletions.
  1. +3 −0  lib/utils/graceful-fs.js
3  lib/utils/graceful-fs.js
View
@@ -6,6 +6,7 @@
// anything else.
var fs = require("fs")
, timeout = 0
+ , resetTimer
Object.keys(fs)
.forEach(function (i) {
@@ -25,6 +26,8 @@ function graceful (fn) { return function GRACEFUL () {
return setTimeout(function () {
GRACEFUL.apply(fs, args)
}, timeout ++)
+ if (resetTimer) clearTimeout(resetTimer)
+ resetTimer = setTimeout(function () { timeout = 0 }, 1000)
}
cb_.apply(null, arguments)
}
Please sign in to comment.
Something went wrong with that request. Please try again.