Skip to content

Commit 377d2fb

Browse files
committed
fix(gateway): recover poisoned cert status lock
Avoid Clippy-denied unwrap calls when reading or updating node-local certificate attempt status. Recover the inner map after mutex poisoning so observability remains available instead of panicking.
1 parent 34a6ebc commit 377d2fb

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

dstack/gateway/src/distributed_certbot.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,13 +149,17 @@ impl DistributedCertBot {
149149

150150
/// Status of the most recent issuance/renewal attempt for a domain.
151151
pub fn attempt_status(&self, domain: &str) -> Option<CertAttemptStatus> {
152-
self.statuses.lock().unwrap().get(domain).cloned()
152+
self.statuses
153+
.lock()
154+
.unwrap_or_else(|err| err.into_inner())
155+
.get(domain)
156+
.cloned()
153157
}
154158

155159
/// Record the outcome of an issuance/renewal attempt.
156160
fn record_attempt<T>(&self, domain: &str, result: &Result<T>) {
157161
let now = now_secs();
158-
let mut statuses = self.statuses.lock().unwrap();
162+
let mut statuses = self.statuses.lock().unwrap_or_else(|err| err.into_inner());
159163
let status = statuses.entry(domain.to_string()).or_default();
160164
status.last_attempt_at = now;
161165
status.attempted_by = self.kv_store.my_node_id();

0 commit comments

Comments
 (0)