Compare commits

...

3 Commits

2 changed files with 6 additions and 4 deletions

View File

@ -58,6 +58,8 @@ new Actor(async (t: Turn) => {
const boxpath = path.join(__dirname, 'box.js');
const clientpath = path.join(__dirname, 'client.js');
t.activeFacet.preventInertCheck();
// spawnModule(t, boxpath, [embed(ds_for_box), 500000, 25000]);
spawnWorker(t, boxpath, [embed(ds_for_box), 50000, 2500]);

View File

@ -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));
}
}
@ -151,7 +151,7 @@ export class Turn {
const t = new Turn(facet);
try {
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;
} catch (err) {
Turn.for(facet.actor.root, t => facet.actor.terminateWith(t, { ok: false, err }));