Skip to content

Commit

Permalink
more explicit instance termination
Browse files Browse the repository at this point in the history
  • Loading branch information
smklein committed Jul 5, 2024
1 parent 691bc85 commit e360dae
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion sled-agent/src/instance_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,17 @@ impl InstanceManagerRunner {

for id in to_remove {
info!(self.log, "only_use_disks: Removing instance"; "instance_id" => ?id);
self.instances.remove(&id);
if let Some((_, instance)) = self.instances.remove(&id) {
let (tx, rx) = oneshot::channel();
if let Err(e) = instance.terminate(tx).await {
warn!(self.log, "only_use_disks: Failed to request instance removal"; "err" => ?e);
continue;
}

if let Err(e) = rx.await {
warn!(self.log, "only_use_disks: Failed while removing instance"; "err" => ?e);
}
}
}

tx.send(Ok(())).map_err(|_| Error::FailedSendClientClosed)?;
Expand Down

0 comments on commit e360dae

Please sign in to comment.