Fix issue where Flipper start starved
Summary: `yarn start` basically starves if watchman is still scanning the system, until that is completed (which took 40 minutes for me last time). Added a timeout of 1 minute, to signal that you can better to some dishes, instead of trying to hunt a bug that looks like an exception has been eaten somewhere (guess what I did..) Reviewed By: timur-valiev Differential Revision: D30806512 fbshipit-source-id: a2ebc3672d82f3388fc7b00f41c7e9c4f37794b3
This commit is contained in:
committed by
Facebook GitHub Bot
parent
e1e9ca0f52
commit
c3b2fe836d
@@ -11,6 +11,8 @@ import {Client} from 'fb-watchman';
|
|||||||
import {v4 as uuid} from 'uuid';
|
import {v4 as uuid} from 'uuid';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|
||||||
|
const watchmanTimeout = 60 * 1000;
|
||||||
|
|
||||||
export default class Watchman {
|
export default class Watchman {
|
||||||
constructor(private rootDir: string) {}
|
constructor(private rootDir: string) {}
|
||||||
|
|
||||||
@@ -31,6 +33,11 @@ export default class Watchman {
|
|||||||
this.client!.end();
|
this.client!.end();
|
||||||
delete this.client;
|
delete this.client;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const timeouthandle = setTimeout(() => {
|
||||||
|
onError(new Error('Timeout when trying to start Watchman'));
|
||||||
|
}, watchmanTimeout);
|
||||||
|
|
||||||
this.client!.once('error', onError);
|
this.client!.once('error', onError);
|
||||||
this.client!.capabilityCheck(
|
this.client!.capabilityCheck(
|
||||||
{optional: [], required: ['relative_root']},
|
{optional: [], required: ['relative_root']},
|
||||||
@@ -51,6 +58,7 @@ export default class Watchman {
|
|||||||
}
|
}
|
||||||
this.watch = resp.watch;
|
this.watch = resp.watch;
|
||||||
this.relativeRoot = resp.relative_path;
|
this.relativeRoot = resp.relative_path;
|
||||||
|
clearTimeout(timeouthandle);
|
||||||
resolve();
|
resolve();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user