Skip to content

Conversation

@glopesdev
Copy link
Member

@glopesdev glopesdev commented Jul 18, 2025

Transport initialization and disposal are asynchronous and also depend on operator state, which may be shared across parallel subscriptions. To allow dynamic instantiation of transports from a single operator, this state needs to be captured immediately on observable creation and retained as a copy throughout the entire transport lifetime.

As a further note, it is not enough to capture on subscribe, since error handling operators such as Retry may inadvertently cause state to be shared, and also the async lambda is not guaranteed to run synchronously even if the first few steps are calls to synchronous methods.

Fixes #96

@glopesdev glopesdev requested a review from jfrazao July 18, 2025 10:20
@glopesdev glopesdev added the fix Pull request that fixes an issue label Jul 18, 2025
Transport initialization and disposal are asynchronous and also depend
on operator state, which may be shared across parallel subscriptions.
To allow dynamic instantiation of transports from a single operator,
this state needs to be captured immediately on observable creation and
retained as a copy throughout the entire transport lifetime.

It is not enough to capture on subscribe, since error handling operators
such as Retry may inadvertently cause state to be shared, and also the
async lambda is not guaranteed to run synchronously even if the first
few steps are calls to synchronous methods.
@glopesdev glopesdev requested a review from bruno-f-cruz July 23, 2025 11:40
@glopesdev glopesdev merged commit 9f16dc6 into bonsai-rx:main Jul 23, 2025
10 checks passed
@glopesdev glopesdev deleted the issue-96 branch July 23, 2025 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Pull request that fixes an issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ensure PortName is captured on subscription

1 participant