Skip to content

Commit 00635d5

Browse files
committed
fix: recover from poisoned Config mutex in tests
1 parent baadf5a commit 00635d5

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/config.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ impl Config {
3535
/// Initialize global config from environment variables (call once at startup).
3636
/// Can be called multiple times - subsequent calls are no-ops.
3737
pub fn init() {
38-
let mut config = CONFIG.lock().unwrap();
38+
let mut config = CONFIG.lock().unwrap_or_else(|e| e.into_inner());
3939
if config.is_none() {
4040
*config = Some(Self::from_env());
4141
}
@@ -55,7 +55,7 @@ impl Config {
5555
/// Allows tests to reinitialize config with different env vars.
5656
#[cfg(test)]
5757
pub fn reset() {
58-
*CONFIG.lock().unwrap() = None;
58+
*CONFIG.lock().unwrap_or_else(|e| e.into_inner()) = None;
5959
}
6060

6161
/// Load configuration from environment variables

0 commit comments

Comments
 (0)