From b975342e7b1fb708e1be4e277215772e8b714ddd Mon Sep 17 00:00:00 2001 From: Jean Lauliac Date: Thu, 1 Jun 2017 10:06:32 -0700 Subject: [PATCH] metro-bundler: AssetServer: remove fs timeouts Reviewed By: cpojer Differential Revision: D5164550 fbshipit-source-id: 2d294906c7deb67468dd9f85aa5ca998bdadcef3 --- packager/src/AssetServer/index.js | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/packager/src/AssetServer/index.js b/packager/src/AssetServer/index.js index d77fc5b2b..0d5a62e8f 100644 --- a/packager/src/AssetServer/index.js +++ b/packager/src/AssetServer/index.js @@ -20,23 +20,9 @@ const path = require('path'); import type {AssetData} from '../node-haste/lib/AssetPaths'; -const createTimeoutPromise = timeout => new Promise((resolve, reject) => { - setTimeout(reject, timeout, 'fs operation timeout'); -}); -function timeoutableDenodeify(fsFunc, timeout) { - return function raceWrapper(...args) { - return Promise.race([ - createTimeoutPromise(timeout), - denodeify(fsFunc).apply(this, args), - ]); - }; -} - -const FS_OP_TIMEOUT = parseInt(process.env.REACT_NATIVE_FSOP_TIMEOUT, 10) || 15000; - -const stat = timeoutableDenodeify(fs.stat, FS_OP_TIMEOUT); -const readDir = timeoutableDenodeify(fs.readdir, FS_OP_TIMEOUT); -const readFile = timeoutableDenodeify(fs.readFile, FS_OP_TIMEOUT); +const stat = denodeify(fs.stat); +const readDir = denodeify(fs.readdir); +const readFile = denodeify(fs.readFile); class AssetServer {