Skip to content

Add cancellation support to session::tokio functions #100

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fjarri
Copy link
Member

@fjarri fjarri commented Apr 30, 2025

This should allow users to impose an external timeout (or to cancel the session loop manually, e.g. on keyboard interrupt).

Also fixed some error processing lapses in par_run_session() where closing of the incoming message channel (or internal channels) was silently ignored.

for reviewers: should we use it to add timeout support in dev::tokio functions?

May invalidate #12

@fjarri fjarri self-assigned this Apr 30, 2025
@fjarri fjarri marked this pull request as ready for review April 30, 2025 19:02
@fjarri fjarri requested a review from dvdplm April 30, 2025 19:02
@fjarri
Copy link
Member Author

fjarri commented Apr 30, 2025

@peg FYI

@coveralls
Copy link

coveralls commented Apr 30, 2025

Pull Request Test Coverage Report for Build 14842568648

Details

  • 37 of 44 (84.09%) changed or added relevant lines in 2 files are covered.
  • 12 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.4%) to 72.26%

Changes Missing Coverage Covered Lines Changed/Added Lines %
manul/src/session/tokio.rs 33 40 82.5%
Files with Coverage Reduction New Missed Lines %
manul/src/session/tokio.rs 12 82.97%
Totals Coverage Status
Change from base Build 14842544562: -0.4%
Covered Lines: 2149
Relevant Lines: 2974

💛 - Coveralls

Copy link
Contributor

@dvdplm dvdplm left a comment

Choose a reason for hiding this comment

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

I am no expert on tokio but afaik using cancellation tokens like this is idiomatic and the code looks good to me.

As for the question I need to research it a bit more; I honestly don't know what the idiomatic pattern is for deadlines/timeouts. It sounds plausible that cancellation tokens are part of the right answer, but it also seems like there'd a higher level API that we should be using?

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.

3 participants