Skip to content

Commit

Permalink
refactor(daemon): Simplify incarnateGuest parallelism
Browse files Browse the repository at this point in the history
  • Loading branch information
rekmarks committed Mar 8, 2024
1 parent 8f44e6e commit f546680
Showing 1 changed file with 12 additions and 19 deletions.
31 changes: 12 additions & 19 deletions packages/daemon/src/daemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -1015,35 +1015,28 @@ const makeDaemonCore = async (
storeFormulaIdentifier,
workerFormulaIdentifier,
} = await formulaGraphMutex.enqueue(async () => {
const [
ownFormulaNumber,
hostHandle,
storeIncarnation,
workerIncarnation,
] = await Promise.all([
randomHex512(),
randomHex512(),
randomHex512(),
randomHex512(),
]).then(([own, handle, store, worker]) =>
Promise.all([
own,
incarnateNumberedHandle(handle, hostFormulaIdentifier),
incarnateNumberedPetStore(store),
incarnateNumberedWorker(worker),
]),
const formulaNumber = await randomHex512();
const hostHandle = await incarnateNumberedHandle(
await randomHex512(),
hostFormulaIdentifier,
);
const storeIncarnation = await incarnateNumberedPetStore(
await randomHex512(),
);
const workerIncarnation = await incarnateNumberedWorker(
await randomHex512(),
);

await deferredTasks.execute({
guestFormulaIdentifier: serializeFormulaIdentifier({
type: 'guest',
number: ownFormulaNumber,
number: formulaNumber,
node: ownNodeIdentifier,
}),
});

return harden({
guestFormulaNumber: ownFormulaNumber,
guestFormulaNumber: formulaNumber,
hostHandleFormulaIdentifier: hostHandle.formulaIdentifier,
storeFormulaIdentifier: storeIncarnation.formulaIdentifier,
workerFormulaIdentifier: workerIncarnation.formulaIdentifier,
Expand Down

0 comments on commit f546680

Please sign in to comment.