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

[RateLimiting] Fix test race with timer #72118

Merged
merged 2 commits into from
Jul 21, 2022

Conversation

BrennanConroy
Copy link
Member

Fixes #72060

@ghost
Copy link

ghost commented Jul 13, 2022

Tagging subscribers to this area: @mangod9
See info in area-owners.md if you want to be subscribed.

Issue Details

Fixes #72060

Author: BrennanConroy
Assignees: -
Labels:

area-System.Threading

Milestone: 7.0.0

@@ -13,7 +13,7 @@ namespace System.Threading.RateLimiting.Tests
{
internal static class Utils
{
internal static Func<Task> StopTimerAndGetTimerFunc<T>(PartitionedRateLimiter<T> limiter)
internal static async Task<Func<Task>> StopTimerAndGetTimerFunc<T>(PartitionedRateLimiter<T> limiter)
Copy link
Member

Choose a reason for hiding this comment

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

This type signature! 😆 It looks like this should fix the bug, but can we just add a private/internal ctor to DefaultPartitionedRateLimiter that doesn't start the timer?

Copy link
Member Author

Choose a reason for hiding this comment

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

Tried out the private ctor approach. Definitely removes the possibility of test races now.

@BrennanConroy BrennanConroy merged commit f7d7b55 into dotnet:main Jul 21, 2022
@BrennanConroy BrennanConroy deleted the brecon/timerStop branch July 21, 2022 20:08
@ghost ghost locked as resolved and limited conversation to collaborators Aug 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.