mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-09 21:21:11 +00:00
Reduce signal channel sizes and more logging on approval-voting (#2751)
* reduce signal channel capacity * more tracing for approval-voting
This commit is contained in:
committed by
GitHub
parent
afc9bf8f25
commit
fc154d2ada
@@ -495,9 +495,25 @@ async fn imported_block_info(
|
||||
}
|
||||
};
|
||||
|
||||
tracing::trace!(
|
||||
target: LOG_TARGET,
|
||||
n_assignments = assignments.len(),
|
||||
"Produced assignments"
|
||||
);
|
||||
|
||||
let force_approve =
|
||||
block_header.digest.convert_first(|l| match ConsensusLog::from_digest_item(l) {
|
||||
Ok(Some(ConsensusLog::ForceApprove(num))) if num < block_header.number => Some(num),
|
||||
Ok(Some(ConsensusLog::ForceApprove(num))) if num < block_header.number => {
|
||||
tracing::trace!(
|
||||
target: LOG_TARGET,
|
||||
?block_hash,
|
||||
current_number = block_header.number,
|
||||
approved_number = num,
|
||||
"Force-approving based on header digest"
|
||||
);
|
||||
|
||||
Some(num)
|
||||
}
|
||||
Ok(Some(_)) => None,
|
||||
Ok(None) => None,
|
||||
Err(err) => {
|
||||
@@ -635,6 +651,12 @@ pub(crate) async fn handle_new_head(
|
||||
imported_blocks_and_info
|
||||
};
|
||||
|
||||
tracing::trace!(
|
||||
target: LOG_TARGET,
|
||||
imported_blocks = imported_blocks_and_info.len(),
|
||||
"Inserting imported blocks into database"
|
||||
);
|
||||
|
||||
for (block_hash, block_header, imported_block_info) in imported_blocks_and_info {
|
||||
let ImportedBlockInfo {
|
||||
included_candidates,
|
||||
@@ -708,10 +730,24 @@ pub(crate) async fn handle_new_head(
|
||||
};
|
||||
|
||||
if let Some(up_to) = force_approve {
|
||||
tracing::debug!(
|
||||
target: LOG_TARGET,
|
||||
?block_hash,
|
||||
up_to,
|
||||
"Enacting force-approve",
|
||||
);
|
||||
|
||||
approval_db::v1::force_approve(db_writer, block_hash, up_to)
|
||||
.map_err(|e| SubsystemError::with_origin("approval-voting", e))?;
|
||||
}
|
||||
|
||||
tracing::trace!(
|
||||
target: LOG_TARGET,
|
||||
?block_hash,
|
||||
block_number = block_header.number,
|
||||
"Writing BlockEntry",
|
||||
);
|
||||
|
||||
let candidate_entries = approval_db::v1::add_block_entry(
|
||||
db_writer,
|
||||
block_entry,
|
||||
@@ -747,6 +783,13 @@ pub(crate) async fn handle_new_head(
|
||||
);
|
||||
}
|
||||
|
||||
tracing::trace!(
|
||||
target: LOG_TARGET,
|
||||
head = ?head,
|
||||
chain_length = approval_meta.len(),
|
||||
"Informing distribution of newly imported chain",
|
||||
);
|
||||
|
||||
ctx.send_message(ApprovalDistributionMessage::NewBlocks(approval_meta).into()).await;
|
||||
|
||||
Ok(imported_candidates)
|
||||
|
||||
@@ -96,6 +96,9 @@ use polkadot_node_primitives::SpawnNamed;
|
||||
|
||||
// A capacity of bounded channels inside the overseer.
|
||||
const CHANNEL_CAPACITY: usize = 1024;
|
||||
// The capacity of signal channels to subsystems.
|
||||
const SIGNAL_CHANNEL_CAPACITY: usize = 64;
|
||||
|
||||
// A graceful `Overseer` teardown time delay.
|
||||
const STOP_DELAY: u64 = 1;
|
||||
// Target for logs.
|
||||
@@ -2629,7 +2632,7 @@ fn spawn<S: SpawnNamed, M: Send + 'static>(
|
||||
futures: &mut FuturesUnordered<BoxFuture<'static, SubsystemResult<()>>>,
|
||||
task_kind: TaskKind,
|
||||
) -> SubsystemResult<OverseenSubsystem<M>> {
|
||||
let (signal_tx, signal_rx) = metered::channel(CHANNEL_CAPACITY);
|
||||
let (signal_tx, signal_rx) = metered::channel(SIGNAL_CHANNEL_CAPACITY);
|
||||
let ctx = OverseerSubsystemContext::new(
|
||||
signal_rx,
|
||||
message_rx,
|
||||
|
||||
Reference in New Issue
Block a user