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

refactor: Wallet owns its update stream #51

Merged
merged 1 commit into from
Oct 3, 2024
Merged

Conversation

tvolk131
Copy link
Contributor

@tvolk131 tvolk131 commented Oct 3, 2024

Previously, calling Wallet::get_update_stream() spawned a new task on every call. Now, instead, the Wallet owns a single task that polls the federation views, and get_update_stream() simply creates a new stream that watches for the views that are produced by that single task. This also allowed us to add Wallet::force_update_view() which tells the Wallet-owned task to immediately produce the next value rather than waiting, and waits for the latest value to be produced. This ensures that force_update_view() doesn't complete until all streams returned by get_update_stream() have the latest view queued up. We then call force_update_view() at the end of all public Wallet functions that mutate client state. This ensures that the GUI received the latest view from the Wallet view stream before an action function completes.

@tvolk131 tvolk131 force-pushed the owned_wallet_stream branch 3 times, most recently from 2446da5 to 5f76419 Compare October 3, 2024 18:27
@tvolk131 tvolk131 merged commit f5b0860 into master Oct 3, 2024
1 check passed
@tvolk131 tvolk131 deleted the owned_wallet_stream branch October 3, 2024 19:03
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.

1 participant