Skip to content

Commit

Permalink
warning when cluster is absent for a backend or frontend to add
Browse files Browse the repository at this point in the history
  • Loading branch information
Keksoj committed Sep 22, 2023
1 parent 8f135c8 commit e96b0d0
Showing 1 changed file with 28 additions and 20 deletions.
48 changes: 28 additions & 20 deletions bin/src/command/requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
}
}
}
Expand Down

0 comments on commit e96b0d0

Please sign in to comment.