From ef327fb963f8975139d94907d6dfdae581b29554 Mon Sep 17 00:00:00 2001 From: Christien Rioux Date: Sat, 5 Aug 2023 10:49:42 -0400 Subject: [PATCH] crash fix --- veilid-core/src/storage_manager/mod.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/veilid-core/src/storage_manager/mod.rs b/veilid-core/src/storage_manager/mod.rs index 4b21abb7..a5b7e798 100644 --- a/veilid-core/src/storage_manager/mod.rs +++ b/veilid-core/src/storage_manager/mod.rs @@ -201,6 +201,17 @@ impl StorageManager { // Reopen inner to store value we just got let mut inner = self.lock().await?; + // Check again to see if we have a local record already or not + // because waiting for the outbound_get_value action could result in the key being opened + // via some parallel process + + if let Some(res) = inner + .open_existing_record(key, writer, safety_selection) + .await? + { + return Ok(res); + } + // Open the new record inner .open_new_record(key, writer, subkey, subkey_result, safety_selection)