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

refactor(iroh): Single runtime #2525

Merged
merged 3 commits into from
Jul 22, 2024
Merged

refactor(iroh): Single runtime #2525

merged 3 commits into from
Jul 22, 2024

Conversation

rklaehn
Copy link
Contributor

@rklaehn rklaehn commented Jul 22, 2024

Description

Make sure the local pool threads use the main tokio runtime instead of a current_thread runtime per local pool thread.

This is mostly relevant for call to spawn_blocking and spawn from inside local tasks. Before they would go to the single threaded runtime of that thread, now they go to the blocking pool of the main runtime.

This means that the local futures are more tightly integrated with the main runtime. Everything you can do from a spawned future, you should be able to also do from a local future.

Breaking Changes

Surprisingly, none

Notes & open questions

Still not sure if this is OK to do, but given that even tokio::runtime::Handle has a block_on fn, it seems intended usage.

Change checklist

  • Self-review.
  • Documentation updates following the style guide, if relevant.
  • Tests if relevant.
  • All breaking changes documented.

That way we don't spawn tons of runtimes...
@rklaehn rklaehn changed the title Single runtime refactor(iroh): Single runtime Jul 22, 2024
@rklaehn rklaehn changed the base branch from main to safe-local-pool July 22, 2024 10:43
@rklaehn rklaehn marked this pull request as ready for review July 22, 2024 10:50
Copy link
Contributor

@dignifiedquire dignifiedquire left a comment

Choose a reason for hiding this comment

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

if it works, ship it

@rklaehn rklaehn merged commit dfcbcc0 into safe-local-pool Jul 22, 2024
25 checks passed
@rklaehn rklaehn deleted the single-runtime branch July 22, 2024 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants