broker: skip broadcast self-delivery
This commit is contained in:
parent
bded8d789f
commit
0b237d7d8c
1 changed files with 6 additions and 4 deletions
|
|
@ -540,16 +540,18 @@ impl Coordinator {
|
|||
}
|
||||
}
|
||||
|
||||
/// Deliver `body` to every currently-registered agent, appending the
|
||||
/// standard broadcast hint. Returns a list of per-agent error strings
|
||||
/// for any that failed (empty = all ok). The sender's own inbox is
|
||||
/// included — the hint text tells agents to ignore if no action needed.
|
||||
/// Deliver `body` to every currently-registered agent except the sender,
|
||||
/// appending the standard broadcast hint. Returns a list of per-agent
|
||||
/// error strings for any that failed (empty = all ok).
|
||||
pub fn broadcast_send(&self, from: &str, body: &str) -> Vec<String> {
|
||||
const HINT: &str =
|
||||
"\n\n⚠️ _hint: this was a broadcast and may not need any action from you_";
|
||||
let broadcast_body = format!("{body}{HINT}");
|
||||
let mut errors = Vec::new();
|
||||
for agent_name in self.list_agents() {
|
||||
if agent_name == from {
|
||||
continue;
|
||||
}
|
||||
if let Err(e) = self.broker.send(&hive_sh4re::Message {
|
||||
from: from.to_owned(),
|
||||
to: agent_name.clone(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue