Make actor *stop* an orderly termination (vs crash)
This commit is contained in:
parent
9a06f4a633
commit
2beecfc78e
|
@ -60,11 +60,11 @@ export class Actor {
|
|||
terminateWith(t: Turn, reason: Exclude<ExitReason, null>) {
|
||||
if (this.exitReason !== null) return;
|
||||
this.exitReason = reason;
|
||||
if (!this.exitReason.ok) {
|
||||
console.error(`Actor ${this.id} crashed:`, this.exitReason.err);
|
||||
if (!reason.ok) {
|
||||
console.error(`Actor ${this.id} crashed:`, reason.err);
|
||||
}
|
||||
this.exitHooks.forEach(hook => hook(t));
|
||||
queueTask(() => Turn.for(this.root, t => this.root._terminate(t, false), true));
|
||||
queueTask(() => Turn.for(this.root, t => this.root._terminate(t, reason.ok), true));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue