Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(go,rs): nested async support #346

Merged
merged 17 commits into from
Oct 1, 2024

Conversation

rvolosatovs
Copy link
Member

@rvolosatovs rvolosatovs commented Sep 27, 2024

Encoding/decoding nested futures (e.g. future<future<T>>) (inconsistently) indexed the inner future with an index of 0.
For future<future<T>> sent at path x, inner, pending, future element would have been sent on x.0.
For example:
pending(pending(true)) would be sent as:
x: 0x00, 0x00
x.0: 0x01

WIth this PR:
x: 0x00, 0x00, 0x01

This ensures the implementation is consistent with other types (e.g. results or options) and provides greater optimization opportunities (e.g. client-side data batching)

With the above behavior fixed and made consistent across Go and Rust, this also closes #266, which caused leaking subscriptions in Go using async. If not explicitly type-asserted for io.Closer and Close'd, the subscriptions will be closed using runtime finalizers

@rvolosatovs rvolosatovs changed the title fix(go,rs): nested future support fix(go,rs): nested async support Sep 27, 2024
@rvolosatovs rvolosatovs force-pushed the feat/go-nats-unsub branch 2 times, most recently from 0ca81d7 to 024ce22 Compare September 30, 2024 18:33
@rvolosatovs rvolosatovs marked this pull request as ready for review October 1, 2024 07:52
@rvolosatovs rvolosatovs enabled auto-merge October 1, 2024 08:15
@rvolosatovs rvolosatovs disabled auto-merge October 1, 2024 08:17
@rvolosatovs rvolosatovs enabled auto-merge October 1, 2024 08:28
@rvolosatovs rvolosatovs added this pull request to the merge queue Oct 1, 2024
Merged via the queue into bytecodealliance:main with commit 9a77e88 Oct 1, 2024
33 checks passed
@rvolosatovs rvolosatovs deleted the feat/go-nats-unsub branch October 1, 2024 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[go] nested NATS stream lifetime
1 participant