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

proposal: x/sync/singleflight: Add Group.ForgetUnshared #54439

Open
cuonglm opened this issue Aug 13, 2022 · 5 comments
Open

proposal: x/sync/singleflight: Add Group.ForgetUnshared #54439

cuonglm opened this issue Aug 13, 2022 · 5 comments
Labels
Milestone

Comments

@cuonglm
Copy link
Member

cuonglm commented Aug 13, 2022

After #44505, it's now easier to fix #31697.

I am able to re-unify "internal/singleflight" and "golang.org/x/sync/singleflight" APIs, the last missing piece is Group.ForgetUnshared, which is implemented in the former, but not the later.

I propose we add this method to golang.org/x/sync/singleflight.Group:

// ForgetUnshared tells the Group to forget about a key if it is not
// shared with any other goroutines. Future calls to Do for a forgotten key
// will call the function rather than waiting for an earlier call to complete.
// Returns whether the key was forgotten or unknown--that is, whether no
// other goroutines are waiting for the result.
func (g *Group) ForgetUnshared(key string) bool

to unblock #31697.

@gopherbot gopherbot added this to the Proposal milestone Aug 13, 2022
@cuonglm
Copy link
Member Author

cuonglm commented Aug 13, 2022

cc @bradfitz

@ianlancetaylor ianlancetaylor changed the title proposal: golang.org/x/sync/singleflight: Add Group.ForgetUnshared proposal: x/sync/singleflight: Add Group.ForgetUnshared Aug 14, 2022
@gopherbot
Copy link

Change https://go.dev/cl/424114 mentions this issue: singleflight: add Group.ForgetUnshare

@cuonglm

This comment was marked as resolved.

@ianlancetaylor

This comment was marked as resolved.

@cuonglm

This comment was marked as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Incoming
Development

No branches or pull requests

3 participants