Skip to content

Set tolerance to zero when using Task.sleep #2225

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

Merged
merged 2 commits into from
Apr 25, 2025

Conversation

gjcairo
Copy link
Collaborator

@gjcairo gjcairo commented Apr 25, 2025

Task.sleep will by default try and coalesce multiple timers into one, mostly for client-specific reasons such as performance, power consumption, etc.

However, this is undesirable on servers, as it can increase latency, memory usage, and (in the case of gRPC) may result in timeouts not firing when they should.

We can avoid this by setting the sleep tolerance to zero.

@gjcairo gjcairo added the 🔨 semver/patch No public API change. label Apr 25, 2025
@gjcairo gjcairo requested a review from glbrntt April 25, 2025 15:29
Copy link
Collaborator

@glbrntt glbrntt left a comment

Choose a reason for hiding this comment

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

LGTM but the formatter is unhappy

@gjcairo gjcairo enabled auto-merge (squash) April 25, 2025 15:38
@gjcairo gjcairo merged commit c295efd into grpc:main Apr 25, 2025
36 checks passed
@gjcairo gjcairo deleted the task-sleep-tolerance branch April 25, 2025 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 semver/patch No public API change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants