-
Notifications
You must be signed in to change notification settings - Fork 213
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): move code from builder to node and make things nicer #2386
Conversation
e36e948
to
32ef8ac
Compare
1d65c7b
to
ec042bb
Compare
Very much in favour of moving core node logic into node. It always felt weird to have half the logic in the builder! |
handler.inner.sync.doc_start_sync(req).await | ||
}) | ||
let handler = Self::new(inner); | ||
join_set.spawn(async move { |
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.
We are adding lots of tasks to the joinset. Presumably this is so they can all be properly shut down on shutdown.
But is it OK to add lots of tasks without ever calling join_next? won't you aggregate a lot of handles to long-finished short lived tasks?
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.
We do call join_next in the main loop, and break the main loop if a task panics - which is the main reason for the join set IMO (shutdown as well, but it won't matter much in practice because the tasks will also abort once the join set is dropped).
…0-computer#2386) This is a cleanup of the node and builder code. * Move `run` and `gc_loop` from `builder.rs` to `node.rs` - it is not about building but about running. * Improve the code flow and naming all around the builder, spawn and run functions * Make sure we shutdown the node correctly while spawning * Removed `Node::controller`. Use `Node::client` instead. The former was mostly unusable anyway because we made the RPC structs private. <!-- Any notes, remarks or open questions you have to make about the PR. --> - [x] Self-review. - [x] Documentation updates if relevant. - [ ] ~~Tests if relevant.~~ - [x] All breaking changes documented.
Description
This is a cleanup of the node and builder code.
run
andgc_loop
frombuilder.rs
tonode.rs
- it is not about building but about running.Breaking Changes
Node::controller
. UseNode::client
instead. The former was mostly unusable anyway because we made the RPC structs private.Notes & open questions
Change checklist
Tests if relevant.