-
Notifications
You must be signed in to change notification settings - Fork 2.6k
consensus: prioritize finality work over block import in queue #7307
Conversation
50b0580
to
2f57ae8
Compare
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.
A test would be really really cool :P
@@ -46,7 +48,8 @@ pub struct BasicQueue<B: BlockT, Transaction> { | |||
impl<B: BlockT, Transaction> Drop for BasicQueue<B, Transaction> { | |||
fn drop(&mut self) { | |||
// Flush the queue and close the receiver to terminate the future. | |||
self.sender.close_channel(); | |||
self.finality_sender.close_channel(); |
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.
https://docs.rs/futures-channel/0.3.6/src/futures_channel/mpsc/mod.rs.html#991
Actually that is done automatically :P
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.
I guess this was done explicitly in case there's more than one instance of the sender. I don't really have a strong opinion on this.
use worker_messages::*; | ||
|
||
let (finality_sender, mut finality_port) = | ||
tracing_unbounded("mpsc_import_queue_worker_finality"); |
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.
Isn't this and below spsc
? xD
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 channel is mpsc
but yeah in practice there's only one producer. But all tracing_unbounded
metrics have the mpsc
prefix 🤷.
The import queue should prioritize finality work over block import since finality work is less common and lighter than block import (especially during major sync), and performing the finality work can then lead to faster block import (or rather it solves slowdowns caused by longer stretches of unfinalized blocks).