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

break: refreshable/v2 with Generic type handling #252

Merged
merged 15 commits into from
Aug 10, 2023
Merged

Conversation

bmoylan
Copy link
Contributor

@bmoylan bmoylan commented Jun 1, 2022

This change is Reviewable

Comment on lines 40 to 41
r.cancel()
r.in.Update(val)
Copy link

Choose a reason for hiding this comment

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

Shouldn't the order here be reversed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep, fixed, thanks!

// NewFromTickerFunc returns a Ready Refreshable populated by the result of the provider called each interval.
// If the providers bool return is false, the value is ignored.
// The result's ReadyC channel is closed when a new value is populated.
func NewFromTickerFunc[T any](interval time.Duration, provider func() (T, bool)) (Ready[T], UnsubscribeFunc) {

Choose a reason for hiding this comment

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

Can we pass context into the provider function so that clients can make use of it (e.g. for logging unexpected behaviour)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done!

@bmoylan bmoylan marked this pull request as ready for review August 7, 2023 16:51
@k-simons
Copy link
Contributor

👍

@bmoylan bmoylan merged commit 5a10d90 into master Aug 10, 2023
@bmoylan bmoylan deleted the bm/refreshable-v2 branch August 10, 2023 15:40
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.

4 participants