You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary:
Adds the ability to periodically check the health of the filesystem watcher by writing a temporary file to the project and waiting for it to be observed.
This is off by default and does not generally need to be turned on by end users. It's primarily useful for debugging/monitoring the reliability of the underlying watcher or filesystem.
Implementation approach:
* The `Watcher` class (new in D39891465 (dc02eac)) now has a `checkHealth` method that returns a machine-readable description of the result of a health check (success, timeout or error, plus some metadata).
* The `Watcher` class hides health check files from `HasteMap`; it excludes them from crawl results and doesn't forward notifications about them.
* If health checks are enabled, `HasteMap` performs one as soon as a watch is established, and sets an interval to run checks periodically.
* `HasteMap` emits `healthCheck` events with health check results.
* `DependencyGraph` converts `healthCheck` events to `ReportableEvent`s and logs them via the current `reporter`.
* `TerminalReporter` prints a human-readable version of the health check result when there is a relevant change.
Changelog:
* **[Feature]**: Add configurable watcher health check that is off by default.
Reviewed By: robhogan
Differential Revision: D40352039
fbshipit-source-id: 75ed4bd845b7919cfee4f64223a24444c98d1735
Copy file name to clipboardExpand all lines: docs/Configuration.md
+38
Original file line number
Diff line number
Diff line change
@@ -418,6 +418,44 @@ Therefore, the two behaviour differences from `resolver.sourceExts` when importi
418
418
419
419
Defaults to `['cjs', 'mjs']`.
420
420
421
+
#### `healthCheck.enabled`
422
+
423
+
Type: `boolean`
424
+
425
+
Whether to periodically check the health of the filesystem watcher by writing a temporary file to the project and waiting for it to be observed.
426
+
427
+
The default value is `false`.
428
+
429
+
#### `healthCheck.filePrefix`
430
+
431
+
Type: `string`
432
+
433
+
If watcher health checks are enabled, this property controls the name of the temporary file that will be written into the project filesystem.
434
+
435
+
The default value is `'.metro-health-check'`.
436
+
437
+
:::note
438
+
439
+
There's no need to commit health check files to source control. If you choose to enable health checks in your project, make sure you add `.metro-health-check*` to your `.gitignore` file to avoid generating unnecessary changes.
440
+
441
+
:::
442
+
443
+
#### `healthCheck.interval`
444
+
445
+
Type: `number`
446
+
447
+
If watcher health checks are enabled, this property controls how often they occur (in milliseconds).
448
+
449
+
The default value is 30000.
450
+
451
+
#### `healthCheck.timeout`
452
+
453
+
Type: `number`
454
+
455
+
If watcher health checks are enabled, this property controls the time (in milliseconds) Metro will wait for a file change to be observed before considering the check to have failed.
0 commit comments