fix: drop Mutex before calling tx_approve.send() (#2876)

This commit is contained in:
Michael Bolin
2025-08-28 22:49:29 -07:00
committed by GitHub
parent cb2f952143
commit c988ce28fe

View File

@@ -657,10 +657,18 @@ impl Session {
} }
pub fn notify_approval(&self, sub_id: &str, decision: ReviewDecision) { pub fn notify_approval(&self, sub_id: &str, decision: ReviewDecision) {
let entry = {
let mut state = self.state.lock_unchecked(); let mut state = self.state.lock_unchecked();
if let Some(tx_approve) = state.pending_approvals.remove(sub_id) { state.pending_approvals.remove(sub_id)
};
match entry {
Some(tx_approve) => {
tx_approve.send(decision).ok(); tx_approve.send(decision).ok();
} }
None => {
warn!("No pending approval found for sub_id: {sub_id}");
}
}
} }
pub fn add_approved_command(&self, cmd: Vec<String>) { pub fn add_approved_command(&self, cmd: Vec<String>) {