Skip to content

Auto-port 5.0: Use Ticker in Http2MaxRstFrameListener for testability - #17001

Merged
normanmaurer merged 1 commit into
5.0from
auto-port-pr-16993-to-5.0
Jun 26, 2026
Merged

normanmaurer merged 1 commit into
5.0from
auto-port-pr-16993-to-5.0

Conversation

@netty-project-bot

Copy link
Copy Markdown
Contributor

Auto-port of #16993 to 5.0
Cherry-picked commit: 22e06b3


Motivation:
Http2MaxRstFrameListener reads the current time directly via
System.nanoTime(), which makes the rate-limiting logic hard to test
deterministically. The accompanying test had to rely on real time and
sleeps, which is both slow and flaky.

Modifications:

  • Make Http2MaxRstFrameListener use an injectable Ticker instead of
    System.nanoTime(); Http2MaxRstFrameDecoder forwards it.
  • Replace Thread.sleep in Http2MaxRstFrameListenerTest with MockTicker

Result:
Tests run deterministically without sleeping.
No public API change.

Motivation:
`Http2MaxRstFrameListener` reads the current time directly via
`System.nanoTime()`, which makes the rate-limiting logic hard to test
deterministically. The accompanying test had to rely on real time and
sleeps, which is both slow and flaky.

Modifications:
* Make Http2MaxRstFrameListener use an injectable Ticker instead of
  System.nanoTime(); Http2MaxRstFrameDecoder forwards it.
* Replace Thread.sleep in Http2MaxRstFrameListenerTest with MockTicker

Result:
Tests run deterministically without sleeping.
No public API change.

---------

Co-authored-by: Norman Maurer <[email protected]>
(cherry picked from commit 22e06b3)
@normanmaurer
normanmaurer merged commit 9ac8023 into 5.0 Jun 26, 2026
12 of 13 checks passed
@normanmaurer
normanmaurer deleted the auto-port-pr-16993-to-5.0 branch June 26, 2026 13:30
@normanmaurer normanmaurer added this to the 5.0.0.Final milestone Jun 26, 2026
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.

3 participants