From 29fad09251234d7a35799abe9257c825a2ca36cf Mon Sep 17 00:00:00 2001 From: Dan Connolly Date: Fri, 22 Nov 2024 10:57:00 -0600 Subject: [PATCH] fix!(orchestration): expose subscribeToTransfers() race to caller There was a race in subscribeToTransfers. Rather than fail some cases with "already registered", return 'RACING' to the loser of the race, who can then try again. --- packages/orchestration/src/exos/packet-tools.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/orchestration/src/exos/packet-tools.js b/packages/orchestration/src/exos/packet-tools.js index a4ba79c2455..4b051c5be3b 100644 --- a/packages/orchestration/src/exos/packet-tools.js +++ b/packages/orchestration/src/exos/packet-tools.js @@ -126,7 +126,7 @@ export const preparePacketTools = (zone, vowTools) => { const resolverToPattern = zone.detached().mapStore('resolverToPattern'); return { lca, - reg: /** @type {Remote | null} */ (null), + reg: /** @type {Remote | 'RACING' | null} */ (null), resolverToPattern, upcallQueue: /** @type {any[] | null} */ (null), pending: 0, @@ -340,6 +340,7 @@ export const preparePacketTools = (zone, vowTools) => { const { tap } = this.facets; // XXX racy; fails if subscribeToTransfers is called while this promise is in flight // e.g. 'Target "agoric1fakeLCAAddress" already registered' + this.state.reg = 'RACING'; return when(E(lca).monitorTransfers(tap), r => { this.state.reg = r; return r;