Skip to content

Commit

Permalink
fix!(orchestration): expose subscribeToTransfers() race to caller
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dckc committed Nov 22, 2024
1 parent 0105e1a commit 29fad09
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/orchestration/src/exos/packet-tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export const preparePacketTools = (zone, vowTools) => {
const resolverToPattern = zone.detached().mapStore('resolverToPattern');
return {
lca,
reg: /** @type {Remote<TargetRegistration> | null} */ (null),
reg: /** @type {Remote<TargetRegistration> | 'RACING' | null} */ (null),
resolverToPattern,
upcallQueue: /** @type {any[] | null} */ (null),
pending: 0,
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 29fad09

Please sign in to comment.