-
Notifications
You must be signed in to change notification settings - Fork 0
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: support timer refresh
and reset
#5
Comments
There is one thing I'm not sure about. The |
Actually, it's not worth updating the timestamp, We just need to update the schedule time. |
As a side note make sure that once the handler is executed, make sure that those methods throws an exception. |
I've made them a NOP, do they really need to throw an exception? |
I can add in errors but since we don't have any errors in this repo already I have some questions.
|
Please replicate the error style we are using in all other libraries like EFS and Async-init... Etc. |
So there should be an |
Yes for intended behaviour. |
This: this.timeoutRef.refresh(); Does not exist in browsers. We should eventually want to make this work in browsers, so this should be changed. |
Instead of checking if the |
I fixed both of the above in 5624c4f |
Also as I was working in MatrixAI/js-quic#53, I noticed some complicated cancellation of timers. So I added tests to prove how
Thus cancelling timers like keep alive timer and conn timeout timer is really simple:
Is sufficient. At the same time, the handler should then be running and checking if the abortion signal is true. If so, it should stop what it is doing. Otherwise it should propagate the cancellation to any underlying promises. |
A side effect of 5624c4f is that it also fixes the case where the timer is an infinite timer, and you call |
Specification
To complete MatrixAI/Polykey#513 we need to add two features to the
Timer
.refresh
the timer to timeout from the current time with the existing delay.reset
the timer to timeout from the current time with a new delay.Both cases need to update the start time and end time of the timer with reset updating the delay as well.
Additional context
Tasks
refresh
method to theTimer
.reset
method to theTimer
.The text was updated successfully, but these errors were encountered: