Cope with teardown of supervisor

This commit is contained in:
Tony Garnock-Jones 2023-01-30 22:35:54 +01:00
parent 0922c6e9b1
commit 31e34039dc
1 changed files with 2 additions and 1 deletions

View File

@ -54,7 +54,8 @@ export class Supervisor {
Turn.activeFacet.onStop(() => {
const exitReason = this.supervisee?.exitReason;
if (!exitReason) {
throw new Error("Expected supervisee to have terminated");
// Supervisor shutdown. Supervisee will exit soon.
return;
}
if (exitReason.ok && (this.config.restartPolicy === SupervisorRestartPolicy.ON_ERROR_ONLY)) {
this.state.value = 'complete';