From 4fb493ab3d537607122c7fbf0316ab0f3ef283b1 Mon Sep 17 00:00:00 2001 From: Alexander Gonzalez Date: Thu, 28 Mar 2024 15:32:15 +0100 Subject: [PATCH] fix(test_utils): recover from lock poisoning in tests --- contracts/src/test_utils.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/src/test_utils.rs b/contracts/src/test_utils.rs index b37d405e..24ea6d39 100644 --- a/contracts/src/test_utils.rs +++ b/contracts/src/test_utils.rs @@ -14,7 +14,7 @@ pub(crate) static STORAGE_MUTEX: Mutex<()> = Mutex::new(()); /// Acquires access to storage. pub(crate) fn acquire_storage() -> MutexGuard<'static, ()> { - STORAGE_MUTEX.lock().unwrap() + STORAGE_MUTEX.lock().unwrap_or_else(|e| e.into_inner()) } /// Decorates a closure by running it with exclusive access to storage.