[Pkg-javascript-commits] [node-graceful-fs] 01/03: New upstream version 4.1.10

Julien Puydt julien.puydt at laposte.net
Fri Nov 4 06:59:36 UTC 2016


This is an automated email from the git hooks/post-receive script.

jpuydt-guest pushed a commit to branch master
in repository node-graceful-fs.

commit 4c5d75369372d9b9f57100af3df088a8015dc000
Author: Julien Puydt <julien.puydt at laposte.net>
Date:   Fri Nov 4 07:58:19 2016 +0100

    New upstream version 4.1.10
---
 package.json |  2 +-
 polyfills.js | 18 +++++++++++++++---
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/package.json b/package.json
index d8e11a5..50dde50 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
 {
   "name": "graceful-fs",
   "description": "A drop-in replacement for fs, making various improvements.",
-  "version": "4.1.9",
+  "version": "4.1.10",
   "repository": {
     "type": "git",
     "url": "https://github.com/isaacs/node-graceful-fs"
diff --git a/polyfills.js b/polyfills.js
index cf474df..ab6b32b 100644
--- a/polyfills.js
+++ b/polyfills.js
@@ -80,15 +80,27 @@ function patch (fs) {
 
   // on Windows, A/V software can lock the directory, causing this
   // to fail with an EACCES or EPERM if the directory contains newly
-  // created files.  Try again on failure, for up to 1 second.
+  // created files.  Try again on failure, for up to 60 seconds.
+
+  // Set the timeout this long because some Windows Anti-Virus, such as Parity
+  // bit9, may lock files for up to a minute, causing npm package install
+  // failures. Also, take care to yield the scheduler. Windows scheduling gives
+  // CPU to a busy looping process, which can cause the program causing the lock
+  // contention to be starved of CPU by node, so the contention doesn't resolve.
   if (process.platform === "win32") {
     fs.rename = (function (fs$rename) { return function (from, to, cb) {
       var start = Date.now()
+      var backoff = 0;
       fs$rename(from, to, function CB (er) {
         if (er
             && (er.code === "EACCES" || er.code === "EPERM")
-            && Date.now() - start < 1000) {
-          return fs$rename(from, to, CB)
+            && Date.now() - start < 60000) {
+          setTimeout(function() {
+            fs$rename(from, to, CB);
+          }, backoff)
+          if (backoff < 100)
+            backoff += 10;
+          return;
         }
         if (cb) cb(er)
       })

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-graceful-fs.git



More information about the Pkg-javascript-commits mailing list