diff --git a/network/src/scheduler.rs b/network/src/scheduler.rs index ab648c9acc..33cb4ed054 100644 --- a/network/src/scheduler.rs +++ b/network/src/scheduler.rs @@ -270,7 +270,9 @@ impl Scheduler { // 3. Participant will try to access the BParticipant senders and receivers with // their next api action, it will fail and be closed then. trace!(?pid, "Got request to close participant"); - if let Some(mut pi) = self.participants.lock().await.remove(&pid) { + let pi = self.participants.lock().await.remove(&pid); + trace!(?pid, "dropped participants lock"); + if let Some(mut pi) = pi { let (finished_sender, finished_receiver) = oneshot::channel(); pi.s2b_shutdown_bparticipant_s .take() @@ -278,8 +280,9 @@ impl Scheduler { .send(finished_sender) .unwrap(); drop(pi); - trace!("dropped bparticipant, waiting for finish"); + trace!(?pid, "dropped bparticipant, waiting for finish"); let e = finished_receiver.await.unwrap(); + trace!(?pid, "waiting completed"); return_once_successful_shutdown.send(e).unwrap(); } else { debug!(?pid, "Looks like participant is already dropped");