-
Notifications
You must be signed in to change notification settings - Fork 36
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
Cleanup expired queries #175
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #175 +/- ##
==========================================
+ Coverage 64.08% 65.06% +0.98%
==========================================
Files 1 1
Lines 284 292 +8
==========================================
+ Hits 182 190 +8
Misses 72 72
Partials 30 30
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
defer func() { | ||
c.mu.Lock() | ||
defer c.mu.Unlock() | ||
for i := len(c.queries) - 1; i >= 0; i-- { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
super-nit
for i := len(c.queries) - 1; i >= 0; i-- { | |
for i := 0; i < len(c.queries); i++ { |
Description
Defers a cleanup of the query entry after it expires, either by receiving an answer or when the context expires.
Reference issue
Fixes #174