-
Notifications
You must be signed in to change notification settings - Fork 189
Added timeout for handling read and write operations #995
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
base: main
Are you sure you want to change the base?
Added timeout for handling read and write operations #995
Conversation
Hi @parth-soni07 , thanks for the quick fixes. The code looks great now. You've resolved the duplicate receive issue and the EOF reading is now using the timeout version like it should. I also noticed you moved the The deadline handling is now working properly throughout the read and write operations, and the error messages are clear and helpful. This is good to merge. Nice work getting the deadline functionality working, this has been a TODO for a while. CC @seetadev and @pacrob |
Hey @paschal533 , thank you for your review! :) |
@parth-soni07 : Appreciate your efforts and contribution. Doing a detailed review. Will share feedback soon. Also, CCing @acul71 and @Jineshbansal, who were working on this feature earlier. Wish if you could resolve the merge conflicts. Once resolved, please ping me. I will re-run the CI/CD pipeline and share test results soon. |
Good work, @parth-soni07! This still needs a newsfragment and testing to verify things are working as expected and to prevent regression. |
@parth-soni07 Implement MplexStream read and write deadline timeout enforcement #987 |
@@ -1,3 +1,4 @@ | |||
import time |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may use trio.current_time() instead of time.time().
time.time() returns wall-clock time, which can jump backward or forward if the system clock changes (e.g., due to NTP).
trio.current_time() is monotonic and stable, making it the safer choice for deadlines and timeouts in async code.
Hey @acul71 , thanks for pointing this out, yes the #987 does what this PR was supposed to do as I analysed it. @seetadev , I think @bomanaps excellently handled this and this PR #995 can be safely closed since the issue seems fixed. |
What was wrong?
Issue #723
How was it fixed?
Modified the read() and write() methods to actually check and enforce the deadlines.