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

Make timers cancellable #10 #25

Merged
merged 2 commits into from
Dec 31, 2023

Conversation

LeedsJohn
Copy link
Contributor

I implemented a feature to make timers cancellable.

I added a function to remove a Timer.t from a Timer_wheel.t which removes the timer from the ids and timers dashmaps. After this, I added Timer.cancel to riot.ml(i).

I wrote a test that has one timer send messages rapidly and another timer send one message. I immediately cancel the "send_interval" timer and assert that the last received message was the one sent from the second timer.

Let me know if there's any changes you would like for me to make - thanks!

test/cancel_timer_test.ml Outdated Show resolved Hide resolved
test/cancel_timer_test.ml Outdated Show resolved Hide resolved
Copy link
Collaborator

@leostera leostera left a comment

Choose a reason for hiding this comment

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

Thanks @LeedsJohn for opening this PR! 🙏🏼

Overall it looks great. The test could use a few adjustments, and I think maybe there's a bug in it? Left you some comments!

After we fix this it'd be good to merge 🚀

Copy link
Collaborator

@leostera leostera left a comment

Choose a reason for hiding this comment

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

Amazing! Thanks @LeedsJohn 🙌🏼 – LGTM!

@leostera leostera merged commit d77c985 into riot-ml:main Dec 31, 2023
0 of 3 checks passed
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