From e96b0d076f6525d6cabaa84143f49ddcf6aa5107 Mon Sep 17 00:00:00 2001 From: Emmanuel Bosquet Date: Fri, 22 Sep 2023 17:12:56 +0200 Subject: [PATCH] warning when cluster is absent for a backend or frontend to add --- bin/src/command/requests.rs | 48 +++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/bin/src/command/requests.rs b/bin/src/command/requests.rs index 2769d6cc2..7940c585f 100644 --- a/bin/src/command/requests.rs +++ b/bin/src/command/requests.rs @@ -226,27 +226,35 @@ impl CommandServer { for request in requests { message_counter += 1; - if self.state.dispatch(&request.content).is_ok() { - diff_counter += 1; - - let mut found = false; - let id = format!("LOAD-STATE-{}-{diff_counter}", request.id); - - for worker in - self.workers.iter_mut().filter(|worker| worker.is_active()) - { - let worker_message_id = format!("{}-{}", id, worker.id); - worker - .send(worker_message_id.clone(), request.content.clone()) - .await; - self.in_flight - .insert(worker_message_id, (load_state_tx.clone(), 1)); - - found = true; + match self.state.dispatch(&request.content) { + Ok(()) => { + diff_counter += 1; + + let mut found = false; + let id = format!("LOAD-STATE-{}-{diff_counter}", request.id); + + for worker in + self.workers.iter_mut().filter(|worker| worker.is_active()) + { + let worker_message_id = format!("{}-{}", id, worker.id); + worker + .send(worker_message_id.clone(), request.content.clone()) + .await; + self.in_flight + .insert(worker_message_id, (load_state_tx.clone(), 1)); + + found = true; + } + + if !found { + bail!("no worker found"); + } } - - if !found { - bail!("no worker found"); + Err(e) => { + warn!( + "Request {} could not be dispatched on the state: {}", + request, e + ); } } }