job_queue: drop insert_unless_live, accept extra queue passes
mara chose to accept extra queued sweep passes over adding a new hive-jobq primitive (or a hive-c0re one-off) for "don't queue another of this kind". Every sweep caller now plain-inserts its node; the capacity-1 Dep::Resource per sweep kind (MatrixSweep/KnowledgeTree) still keeps two passes of the same kind from running concurrently, it just no longer collapses a tick that lands while one is live or queued into the existing one.
This commit is contained in:
parent
1d4c77d2c8
commit
313d582c01
6 changed files with 37 additions and 90 deletions
|
|
@ -238,16 +238,13 @@ async fn drain_swarm_events(
|
|||
return;
|
||||
}
|
||||
tracing::info!(%subject, "swarm events: knowledge change announced, pulling");
|
||||
// Folds into a pull that hasn't started, but queues behind a
|
||||
// running one: that pull may have fetched before this push.
|
||||
match coord.job_queue.insert_unless_live(
|
||||
&crate::job_queue::NodeKind::KnowledgePull,
|
||||
&[crate::job_queue::State::Pending],
|
||||
crate::job_queue::templates::knowledge_pull,
|
||||
) {
|
||||
Ok(Some(_)) => {}
|
||||
Ok(None) => tracing::debug!("swarm events: a knowledge pull is already queued"),
|
||||
Err(e) => tracing::warn!(error = ?e, "swarm events: knowledge pull submit failed"),
|
||||
// Queues unconditionally; the node's `Resource::KnowledgeTree`
|
||||
// dep keeps it from running alongside a pull already in
|
||||
// flight, which may have fetched before this push landed.
|
||||
if let Err(e) = coord.job_queue.insert_job(|b| {
|
||||
vec![crate::job_queue::templates::knowledge_pull(b).guid()]
|
||||
}) {
|
||||
tracing::warn!(error = ?e, "swarm events: knowledge pull submit failed");
|
||||
}
|
||||
}
|
||||
msg = deploy_sub.next() => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue