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

feat(core/time): Add comprehensive tests and documentation for Clock … #12860

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

VolodymyrBg
Copy link

…implementation

  • Add usage examples and detailed API documentation
  • Implement test suite for real and fake clock functionality
  • Document cancellation behavior and time characteristics
  • Remove TODO comment by implementing missing tests

…implementation

- Add usage examples and detailed API documentation
- Implement test suite for real and fake clock functionality
- Document cancellation behavior and time characteristics
- Remove TODO comment by implementing missing tests
@VolodymyrBg VolodymyrBg requested a review from a team as a code owner February 2, 2025 08:30
@VolodymyrBg VolodymyrBg requested a review from akhi3030 February 2, 2025 08:30
@akhi3030 akhi3030 enabled auto-merge February 10, 2025 13:47
auto-merge was automatically disabled February 10, 2025 15:13

Head branch was pushed to by a user without write access

@VolodymyrBg VolodymyrBg requested a review from akhi3030 February 10, 2025 15:29
@akhi3030 akhi3030 enabled auto-merge February 10, 2025 15:42
auto-merge was automatically disabled February 10, 2025 19:47

Head branch was pushed to by a user without write access

@akhi3030 akhi3030 enabled auto-merge February 11, 2025 14:48
auto-merge was automatically disabled February 11, 2025 15:09

Head branch was pushed to by a user without write access

@VolodymyrBg
Copy link
Author

@akhi3030 Corrected everything

core/time/src/clock.rs Outdated Show resolved Hide resolved
core/time/src/clock.rs Outdated Show resolved Hide resolved
core/time/src/clock.rs Outdated Show resolved Hide resolved
core/time/src/clock.rs Outdated Show resolved Hide resolved
@VolodymyrBg VolodymyrBg requested a review from akhi3030 February 11, 2025 16:54
@VolodymyrBg
Copy link
Author

@akhi3030 resolved

Copy link
Collaborator

@akhi3030 akhi3030 left a comment

Choose a reason for hiding this comment

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

Sorry for the back and forth. It is not easy to get the subtleties in code right. I hope this will be one of the final rounds of reviews.

core/time/src/clock.rs Outdated Show resolved Hide resolved
core/time/src/clock.rs Outdated Show resolved Hide resolved
core/time/src/clock.rs Outdated Show resolved Hide resolved
core/time/src/clock.rs Outdated Show resolved Hide resolved
core/time/src/clock.rs Outdated Show resolved Hide resolved
@VolodymyrBg VolodymyrBg requested a review from akhi3030 February 12, 2025 09:47
Comment on lines 226 to 228
if inner.now() >= deadline {
return;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This check seems unnecessary as in it will be quite rarely hit. deadline is now + d. And we know that d is not 0 so chances of this condition being true should be only when the process gets interrupted in between computing deadline and this line which should be quite rare. So I would say we can remove it.

core/time/src/clock.rs Outdated Show resolved Hide resolved
core/time/src/clock.rs Outdated Show resolved Hide resolved
core/time/src/clock.rs Outdated Show resolved Hide resolved
@VolodymyrBg VolodymyrBg requested a review from akhi3030 February 12, 2025 13:14
@akhi3030 akhi3030 enabled auto-merge February 12, 2025 13:47
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.

2 participants