fix(#1838): extract dispatch_rebuild_approval so dispatch stays under the clippy line cap
This commit is contained in:
parent
ef958983e0
commit
96e41c807d
1 changed files with 24 additions and 17 deletions
|
|
@ -852,29 +852,36 @@ pub async fn run_fast_worker(coord: std::sync::Arc<crate::coordinator::Coordinat
|
|||
/// `actions::run_approval_*` which carry the kind-specific commit
|
||||
/// pipeline + the `ApprovalResolved` event fan-out. Non-approval
|
||||
/// entries hit the original auto/manual rebuild paths.
|
||||
/// Pick the right approval pipeline for a `Rebuild` queue entry. Both
|
||||
/// `ApplyCommit` and `MergeConfigPr` approvals enqueue a `Rebuild` entry
|
||||
/// (both end in a container rebuild); branch on the approval kind. Falls
|
||||
/// back to the apply-commit path if the row can't be read — it re-fetches
|
||||
/// + surfaces a clean error itself.
|
||||
async fn dispatch_rebuild_approval(
|
||||
coord: &std::sync::Arc<crate::coordinator::Coordinator>,
|
||||
entry: &QueueEntry,
|
||||
approval_id: i64,
|
||||
) -> anyhow::Result<()> {
|
||||
let kind = coord
|
||||
.approvals
|
||||
.get(approval_id)
|
||||
.ok()
|
||||
.flatten()
|
||||
.map(|a| a.kind);
|
||||
if kind == Some(hive_sh4re::ApprovalKind::MergeConfigPr) {
|
||||
crate::actions::run_approval_merge_config_pr(coord, Some(entry.id), approval_id).await
|
||||
} else {
|
||||
crate::actions::run_approval_apply_commit(coord, Some(entry.id), approval_id).await
|
||||
}
|
||||
}
|
||||
|
||||
async fn dispatch(
|
||||
coord: &std::sync::Arc<crate::coordinator::Coordinator>,
|
||||
entry: &QueueEntry,
|
||||
) -> anyhow::Result<()> {
|
||||
match (entry.kind, entry.approval_id) {
|
||||
(QueueKind::Rebuild, Some(approval_id)) => {
|
||||
// Both ApplyCommit and MergeConfigPr approvals enqueue a Rebuild
|
||||
// entry (they both end in a container rebuild); branch on the
|
||||
// approval kind to pick the right pipeline. Fall back to the
|
||||
// apply-commit path if the row can't be read — it re-fetches +
|
||||
// surfaces a clean error itself.
|
||||
let kind = coord
|
||||
.approvals
|
||||
.get(approval_id)
|
||||
.ok()
|
||||
.flatten()
|
||||
.map(|a| a.kind);
|
||||
if kind == Some(hive_sh4re::ApprovalKind::MergeConfigPr) {
|
||||
crate::actions::run_approval_merge_config_pr(coord, Some(entry.id), approval_id)
|
||||
.await
|
||||
} else {
|
||||
crate::actions::run_approval_apply_commit(coord, Some(entry.id), approval_id).await
|
||||
}
|
||||
dispatch_rebuild_approval(coord, entry, approval_id).await
|
||||
}
|
||||
(QueueKind::Rebuild, None) => {
|
||||
let current_rev =
|
||||
|
|
|
|||
Loading…
Reference in a new issue