-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Prioritisation network manager + transactions manager + eth request handler #6590
Conversation
Co-authored-by: DaniPopes <57450786+DaniPopes@users.noreply.github.com>
dug up some helpful resources tasks can starve in tokio, just "not for too long": pre-emption in a loop can cause busy-wait: (Tokio's |
merged into main at commit 3e54d94. looking a lot better than on main. |
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.
the results look great.
I think I can live with the macro, if we rename it to
poll_nested_stream_with_budget!
because I find it yield point misleading because the macro doesn't trigger a yield point (return Pending)
crates/net/network/src/manager.rs
Outdated
let maybe_more_handle_messages = poll_nested_stream_with_yield_points!( | ||
"net", | ||
"Network message channel", | ||
DEFAULT_BUDGET_TRY_DRAIN_NETWORK_HANDLE_CHANNEL, | ||
this.from_handle_rx.poll_next_unpin(cx), | ||
|msg| this.on_handle_message(msg), | ||
error!("Network channel closed"); | ||
); |
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.
hmm, good point, so better be safe than sorry
definitely |
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.
cool, with the extracted eventhandler functions this is a lot easier to read now.
nice work!
Closes #6589. Closes #6336.
Generalises preemption pattern from #6334 (originally from
NetworkManager
when pollingSwarm
). Incorporates this pattern intoNetworkManager
as well asTransactionsManager
.Decomposed into #6656 and #6651 and this pr.