Lwt.Canceled support for MultiWorkerLwt
commit50a5f5a6bb104cacd08b3474e0e6da9adf3412a1
authorGabe Levi <gabe@fb.com>
Wed, 27 Jun 2018 17:29:54 +0000 (27 10:29 -0700)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Wed, 27 Jun 2018 17:43:40 +0000 (27 10:43 -0700)
tree33c842c61a521356eb65cb291b92f25fd3cf5f37
parentbf4c50a1d7011650b595cabfba6fa1a983b4f856
Lwt.Canceled support for MultiWorkerLwt

Summary:
This is actually relatively simple. The general idea:

1. `MultiWorkerLwt.call` runs N worker controllers in parallel using `LwtUtils.iter_all`
2. Someone tries to cancel a thread which is running `MultiWorkerLwt.call`
3. Canceling the `iter_all` propagates the cancellation to each of the N worker controllers automatically
4. A worker controller which is sending a job or merging a job fails immediately (the worker process is idle)
5. A worker controller which is waiting for the worker process to finish a job handles the cancellation, signals all workers to cancel, and waits for its worker to finish being cancelled
6. `MultiWorkerLwt.call` waits for all worker controllers to finish being cancelled and then re-enables all the workers

Reviewed By: avikchaudhuri

Differential Revision: D8161600

fbshipit-source-id: e00fadc690cc73b610f46455260499c121f6087f
hphp/hack/src/procs/multiWorkerLwt.ml
hphp/hack/src/procs/workerControllerLwt.ml