Skip to content

Comments

Implement pacing interceptor#309

Merged
mengelbart merged 1 commit intomasterfrom
pacing-interceptor
Dec 1, 2025
Merged

Implement pacing interceptor#309
mengelbart merged 1 commit intomasterfrom
pacing-interceptor

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.45%. Comparing base (40d68d9) to head (4d47254).
⚠️ Report is 1 commits behind head on master.

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.69%   79.45%   -0.25%     
==========================================
  Files          82       84       +2     
  Lines        4063     4176     +113     
==========================================
+ Hits         3238     3318      +80     
- Misses        659      685      +26     
- Partials      166      173       +7     
Flag Coverage Δ
go 79.45% <74.33%> (-0.25%) ⬇️

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
@mengelbart mengelbart requested review from JoTurk and Sean-Der October 27, 2025 20:32
}

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

@JoTurk JoTurk 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.

@mengelbart mengelbart force-pushed the pacing-interceptor branch 2 times, most recently from fa8021f to 8a125e2 Compare October 30, 2025 20:34
@mengelbart mengelbart merged commit 8dddb51 into master Dec 1, 2025
19 checks passed
@mengelbart mengelbart deleted the pacing-interceptor branch December 1, 2025 15:36
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.

2 participants