Permalink
Browse files

metro-bundler: AssetServer: remove fs timeouts

Reviewed By: cpojer

Differential Revision: D5164550

fbshipit-source-id: 2d294906c7deb67468dd9f85aa5ca998bdadcef3
  • Loading branch information...
jeanlauliac authored and facebook-github-bot committed Jun 1, 2017
1 parent a33dd76 commit b975342e7b1fb708e1be4e277215772e8b714ddd
Showing with 3 additions and 17 deletions.
  1. +3 −17 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 {

0 comments on commit b975342

Please sign in to comment.