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

Simplify timer operations #4032

Merged
merged 10 commits into from
Dec 30, 2023
Merged

Simplify timer operations #4032

merged 10 commits into from
Dec 30, 2023

Conversation

csujedihy
Copy link
Contributor

Description

The existing timer operations rely on a sorted timer entry array, where each entry has a type and expiration time, to maintain the earliest expiration time. However, it's not necessary to maintain a sorted array for this purpose. The earliest expiration time can be calculated on the fly when setting/canceling/expiring timers with the same complexity (it doesn't really matter as we only have a few timer types) and more readable code.

Testing

CI

@csujedihy csujedihy added the Area: Core Related to the shared, core protocol logic label Dec 29, 2023
@csujedihy csujedihy requested a review from a team as a code owner December 29, 2023 01:58
Copy link

codecov bot commented Dec 29, 2023

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (a11b58b) 86.17% compared to head (fe949aa) 86.78%.

Files Patch % Lines
src/core/timer_wheel.c 66.66% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4032      +/-   ##
==========================================
+ Coverage   86.17%   86.78%   +0.60%     
==========================================
  Files          56       56              
  Lines       16953    16929      -24     
==========================================
+ Hits        14610    14691      +81     
+ Misses       2343     2238     -105     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

src/core/connection.c Outdated Show resolved Hide resolved
src/core/connection.h Outdated Show resolved Hide resolved
src/core/connection.c Outdated Show resolved Hide resolved
src/core/connection.c Outdated Show resolved Hide resolved
src/core/connection.c Outdated Show resolved Hide resolved
src/core/connection.c Outdated Show resolved Hide resolved
src/core/connection.c Outdated Show resolved Hide resolved
csujedihy and others added 3 commits December 29, 2023 10:48
Co-authored-by: Nick Banks <nibanks@microsoft.com>
Co-authored-by: Nick Banks <nibanks@microsoft.com>

if (Connection->EarliestExpirationTime == UINT64_MAX) {
Copy link
Member

Choose a reason for hiding this comment

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

I'm wondering how necessary this check is... It might be simpler just to remove it.

@nibanks nibanks merged commit b59b722 into main Dec 30, 2023
404 of 410 checks passed
@nibanks nibanks deleted the huanyi/timer-refactor branch December 30, 2023 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Core Related to the shared, core protocol logic
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants