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

Cleanup expired queries #175

Merged
merged 3 commits into from
Feb 7, 2024
Merged

Cleanup expired queries #175

merged 3 commits into from
Feb 7, 2024

Conversation

SimonVerkada
Copy link
Contributor

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

conn.go Outdated Show resolved Hide resolved
Copy link

codecov bot commented Feb 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (1d4f9bc) 64.08% compared to head (dfc49cb) 65.06%.

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              
Flag Coverage Δ
go 65.06% <100.00%> (+0.98%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@SimonVerkada SimonVerkada requested a review from edaniels February 7, 2024 04:42
Copy link
Member

@edaniels edaniels left a 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-- {
Copy link
Member

Choose a reason for hiding this comment

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

super-nit

Suggested change
for i := len(c.queries) - 1; i >= 0; i-- {
for i := 0; i < len(c.queries); i++ {

@edaniels edaniels merged commit d734c96 into master Feb 7, 2024
14 checks passed
@edaniels edaniels deleted the simon/mdns-cleanup-queries branch February 7, 2024 17:53
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.

Unanswered queries are not cleaned up
2 participants