Option to restart Informant
commit5debce826390e6daa6022a2d3d2f34e97a00012f
authorKasper Kopec <kasper@fb.com>
Fri, 28 Sep 2018 22:28:29 +0000 (28 15:28 -0700)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Fri, 28 Sep 2018 22:45:51 +0000 (28 15:45 -0700)
treeacaf284242b3b10059388e7786151084eafea9d3
parent1a26c0ad3b4d0695db84903bf776ea2da4c67408
Option to restart Informant

Summary:
`Informant` is part of server monitor which listens to Watchman and tries to figure out what is the merge base of current revision (and whether it's worth restarting the server due to changes to it).

I'm adding similar capability to server itself, and run into a problem where we can end up restarting twice in a row - once triggered by server, and once by Informant. To prevent it, we need to restart the Informant when server exits due to mergebase change.

If the server can restart itself, why keep the Informant logic at all, I hear you ask?

The original scenario that Informant was solving was:

* server starts and for some reason goes to typecheck files for many minutes
* user rebases over many revisions
* after the typechecking is finished, server notices that it was useless because `.hhconfig` has changed, or there are so many changes that it's better to restart with new saved state

Since Informant is (by design) never doing any blocking operations, it could spot those situations much sooner and restart the server, saving us from doing the useless typecheck.

With non-blocking typechecking this scenario has become less important, but since server (as opposed to Informant) is often doing other blocking things that were not made interruptible, there are still cases where Informant can make a decision sooner than server. See test plan of D10100451 for example.

Reviewed By: 2BitSalute

Differential Revision: D10100445

fbshipit-source-id: b071bb0b37d309665e78fd3794cf8612d82ee2d5
hphp/hack/src/monitor/informant_sig.ml
hphp/hack/src/server/hhMonitorInformant.ml