fix(#937): use has_pending_with_body in worker — mirrors broker change
This commit is contained in:
parent
ce27ef8b9e
commit
3283362b36
1 changed files with 8 additions and 7 deletions
|
|
@ -97,16 +97,16 @@ fn fire_schedule(coord: &Arc<Coordinator>, schedule: &Schedule, now: i64) {
|
|||
continue;
|
||||
}
|
||||
// Skip delivery if there is already an unread message from
|
||||
// "scheduled" waiting in this target's inbox. Prevents prompt
|
||||
// accumulation when the agent is slow to drain its queue or
|
||||
// was briefly offline: at most one scheduled message is ever
|
||||
// pending per target at a time.
|
||||
match coord.broker.has_pending_from(target, "scheduled") {
|
||||
// "scheduled" waiting in this target's inbox. Prevents the same
|
||||
// scheduled prompt from stacking up when an agent is slow or
|
||||
// briefly offline, while still allowing distinct scheduled
|
||||
// messages (different body) to enqueue independently.
|
||||
match coord.broker.has_pending_with_body(target, "scheduled", &schedule.body) {
|
||||
Ok(true) => {
|
||||
tracing::debug!(
|
||||
schedule = schedule.id,
|
||||
%target,
|
||||
"scheduled_prompts: skipping — target already has pending scheduled message"
|
||||
"scheduled_prompts: skipping — same body already pending for target"
|
||||
);
|
||||
let _ = coord.scheduled_prompts.record_target_result(
|
||||
schedule.id,
|
||||
|
|
@ -117,7 +117,7 @@ fn fire_schedule(coord: &Arc<Coordinator>, schedule: &Schedule, now: i64) {
|
|||
continue;
|
||||
}
|
||||
Err(e) => {
|
||||
tracing::warn!(schedule = schedule.id, %target, error = ?e, "has_pending_from failed");
|
||||
tracing::warn!(schedule = schedule.id, %target, error = ?e, "has_pending_with_body failed");
|
||||
}
|
||||
Ok(false) => {}
|
||||
}
|
||||
|
|
@ -384,3 +384,4 @@ async fn known_agents_async() -> std::collections::HashSet<String> {
|
|||
}
|
||||
out
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue