Skip to content

Commit 8edb952

Browse files
ColChFacebook Github Bot 5
authored andcommitted
make fsop timeout injectable
Summary: We have a weak build machine for React Native app: a poor Mac Book Air with HDD, which is very slow. So, fs operations sometimes fail because of timeout. We likely don't care about build time, but it's pretty annoying to restart builds sometimes. In this PR I make timeout injectable via environment variable. __USAGE__: export this variable into environment. It's measured in miliseconds. Example, for 1 minute timeout: `export REACT_NATIVE_FSOP_TIMEOUT=60000` If you don't specify it, it will remain default value: `15000` This should not break anything, but repair slow builds. Related to : facebook#9373 , facebook#8794 (I think so) This PR should handle case of issue and close facebook#9373 Closes facebook#9374 Differential Revision: D3709325 Pulled By: bestander fbshipit-source-id: b00c89e10d05362314546faea7a4524f3d327c97
1 parent ad67742 commit 8edb952

File tree

1 file changed

+5
-3
lines changed
  • packager/react-packager/src/AssetServer

1 file changed

+5
-3
lines changed

packager/react-packager/src/AssetServer/index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@ function timeoutableDenodeify(fsFunc, timeout) {
2828
};
2929
}
3030

31-
const stat = timeoutableDenodeify(fs.stat, 15000);
32-
const readDir = timeoutableDenodeify(fs.readdir, 15000);
33-
const readFile = timeoutableDenodeify(fs.readFile, 15000);
31+
const FS_OP_TIMEOUT = parseInt(process.env.REACT_NATIVE_FSOP_TIMEOUT, 10) || 15000;
32+
33+
const stat = timeoutableDenodeify(fs.stat, FS_OP_TIMEOUT);
34+
const readDir = timeoutableDenodeify(fs.readdir, FS_OP_TIMEOUT);
35+
const readFile = timeoutableDenodeify(fs.readFile, FS_OP_TIMEOUT);
3436

3537
const validateOpts = declareOpts({
3638
projectRoots: {

0 commit comments

Comments
 (0)