Skip to content

Conversation

@mengelbart
Copy link
Contributor

Description

Implements a pacing interceptor separate from congestion control. The interceptor calls back to implementations of the Pacer interface whenever a packet is sent.

@codecov
Copy link

codecov bot commented Jan 27, 2025

Codecov Report

❌ Patch coverage is 74.33628% with 29 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.30%. Comparing base (051d2e8) to head (8a125e2).

Files with missing lines Patch % Lines
pkg/pacing/interceptor.go 81.55% 14 Missing and 5 partials ⚠️
pkg/pacing/rate_limit_pacer.go 0.00% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #309      +/-   ##
==========================================
- Coverage   79.48%   79.30%   -0.19%     
==========================================
  Files          82       84       +2     
  Lines        4061     4174     +113     
==========================================
+ Hits         3228     3310      +82     
- Misses        662      687      +25     
- Partials      171      177       +6     
Flag Coverage Δ
go 79.30% <74.33%> (-0.19%) ⬇️

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.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mengelbart mengelbart force-pushed the pacing-interceptor branch 7 times, most recently from c12a5b4 to 6f6187a Compare October 19, 2025 17:17
@mengelbart mengelbart marked this pull request as ready for review October 19, 2025 17:19
@mengelbart mengelbart force-pushed the pacing-interceptor branch 3 times, most recently from bfc0780 to 808eb87 Compare October 20, 2025 15:28
}

func (i *Interceptor) loop() {
ticker := time.NewTicker(i.interval)
Copy link
Member

Choose a reason for hiding this comment

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

We don't seem to be calling ticker.Stop()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added a defer ticker.Stop(), although I don't think we necessarily need it since Go 1.23, because the ticker should be garbage collected when it is unreferenced, even without calling Stop. At least that's how I understand the documentation.

Copy link
Member

@JoeTurki JoeTurki Oct 30, 2025

Choose a reason for hiding this comment

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

I read about this, sadly. it's going to be a while before we can drop go 1.22 and 1.21 in pion, also the new behavior is eligible for collection immediately, and it doesn't say that it’s collected immediately, at least from my understanding, but i didn't test it.
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants