andfoy / winpty-rs

Create and spawn processes inside a pseudoterminal in Windows from Rust
Other
23 stars 7 forks source link

fix: remove 100ms delay on first and subsequent read calls #76

Closed SilverMira closed 5 months ago

SilverMira commented 5 months ago

Currently, there is an unnecessary wait with recv_timeout() on reader thread and cache thread.

On reader thread, it causes reading from pipe to have an inherent 100ms wait time between each chunk read. Similarly, cache thread also has this issue, where read() calls are served throttled with a 100ms delay.

This PR replaces recv_timeout with try_recv so all read() calls will return as soon as possible.

Fixes #75

codecov-commenter commented 5 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 78.63%. Comparing base (dbbefcd) to head (5a8aab1).

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #76 +/- ## ========================================== + Coverage 77.57% 78.63% +1.05% ========================================== Files 7 7 Lines 1231 1231 ========================================== + Hits 955 968 +13 + Misses 276 263 -13 ``` | [Flag](https://app.codecov.io/gh/andfoy/winpty-rs/pull/76/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Edgar+Andr%C3%A9s+Margffoy+Tuay) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/andfoy/winpty-rs/pull/76/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Edgar+Andr%C3%A9s+Margffoy+Tuay) | `78.63% <100.00%> (+1.05%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Edgar+Andr%C3%A9s+Margffoy+Tuay#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

andfoy commented 5 months ago

Thanks a lot for your contribution @SilverMira!