Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@adamgfraser
Copy link
Contributor

One issue with the current implementation of SubscriptionRef is that since it is backed by a Queue, if more than one subscriber is observing changes to the Ref each subscriber will miss changes, since each time a value is taken from the queue by one subscriber it is no longer available to other subscribers. We can address this by backing SubscriptionRef with a Hub . This way each subscriber can receive the current value of the Ref and all changes after they have subscribed.

This allows SubscriptionRef to function much like a Var in functional reactive programming frameworks, where the SubscriptionRef represents some state that can be changes and multiple processes can subscribe to take actions in response to any changes in that state.

@adamgfraser adamgfraser requested a review from iravid as a code owner April 9, 2021 00:37
@adamgfraser adamgfraser requested a review from jdegoes April 9, 2021 00:38
Copy link
Member

@iravid iravid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome.

@adamgfraser adamgfraser merged commit 89d921d into zio:master Apr 9, 2021
@adamgfraser adamgfraser deleted the subscriptionref branch April 9, 2021 12:08
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.

2 participants