Compare commits
3 Commits
5085abfcbf
...
41e214e078
Author | SHA1 | Date |
---|---|---|
Tony Garnock-Jones | 41e214e078 | |
Tony Garnock-Jones | 2beecfc78e | |
Tony Garnock-Jones | 9a06f4a633 |
|
@ -58,6 +58,8 @@ new Actor(async (t: Turn) => {
|
||||||
const boxpath = path.join(__dirname, 'box.js');
|
const boxpath = path.join(__dirname, 'box.js');
|
||||||
const clientpath = path.join(__dirname, 'client.js');
|
const clientpath = path.join(__dirname, 'client.js');
|
||||||
|
|
||||||
|
t.activeFacet.preventInertCheck();
|
||||||
|
|
||||||
// spawnModule(t, boxpath, [embed(ds_for_box), 500000, 25000]);
|
// spawnModule(t, boxpath, [embed(ds_for_box), 500000, 25000]);
|
||||||
spawnWorker(t, boxpath, [embed(ds_for_box), 50000, 2500]);
|
spawnWorker(t, boxpath, [embed(ds_for_box), 50000, 2500]);
|
||||||
|
|
||||||
|
|
|
@ -60,11 +60,11 @@ export class Actor {
|
||||||
terminateWith(t: Turn, reason: Exclude<ExitReason, null>) {
|
terminateWith(t: Turn, reason: Exclude<ExitReason, null>) {
|
||||||
if (this.exitReason !== null) return;
|
if (this.exitReason !== null) return;
|
||||||
this.exitReason = reason;
|
this.exitReason = reason;
|
||||||
if (!this.exitReason.ok) {
|
if (!reason.ok) {
|
||||||
console.error(`Actor ${this.id} crashed:`, this.exitReason.err);
|
console.error(`Actor ${this.id} crashed:`, reason.err);
|
||||||
}
|
}
|
||||||
this.exitHooks.forEach(hook => hook(t));
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ export class Turn {
|
||||||
const t = new Turn(facet);
|
const t = new Turn(facet);
|
||||||
try {
|
try {
|
||||||
f(t);
|
f(t);
|
||||||
t.queues!.forEach((q, facet) => queueTask(() => q.forEach(f => Turn.for(facet, f))));
|
t.queues!.forEach((q, facet) => queueTask(() => Turn.for(facet, t=> q.forEach(f => f(t)))));
|
||||||
t.queues = null;
|
t.queues = null;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
Turn.for(facet.actor.root, t => facet.actor.terminateWith(t, { ok: false, err }));
|
Turn.for(facet.actor.root, t => facet.actor.terminateWith(t, { ok: false, err }));
|
||||||
|
|
Loading…
Reference in New Issue