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

Rework cache.Cache to use x/sync/singleflight #113

Merged
merged 3 commits into from
Jan 24, 2024
Merged

Conversation

rowanseymour
Copy link
Member

No description provided.

Copy link

codecov bot commented Jan 24, 2024

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (877c587) 90.05% compared to head (250193d) 90.03%.

Files Patch % Lines
cache/generic.go 88.23% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #113      +/-   ##
==========================================
- Coverage   90.05%   90.03%   -0.03%     
==========================================
  Files          40       40              
  Lines        1940     1936       -4     
==========================================
- Hits         1747     1743       -4     
- Misses        153      155       +2     
+ Partials       40       38       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

}
item := c.cache.Get(key)
if item != nil {
return item, nil
Copy link
Member Author

Choose a reason for hiding this comment

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

I can only get a thread here if I add a small random delay in Get between the cache lookup and the call to fetch and set, e.g. time.Sleep(time.Duration(random.IntN(100)) * time.Millisecond)

@rowanseymour rowanseymour merged commit 7434ec2 into main Jan 24, 2024
3 of 5 checks passed
@rowanseymour rowanseymour deleted the singleflight branch January 24, 2024 18:06
@github-actions github-actions bot locked and limited conversation to collaborators Jan 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant