Keystore 2.0: Install database busy handler.
Make keystore DB poll every 50us for the database lock.
Test: N/A
Change-Id: Ibb6c8d438e4b3d99d80671b6720baad23cc17a0d
diff --git a/keystore2/src/database.rs b/keystore2/src/database.rs
index 785847d..4e12c64 100644
--- a/keystore2/src/database.rs
+++ b/keystore2/src/database.rs
@@ -617,6 +617,11 @@
perboot_path_str.push_str(&perboot_path.to_string_lossy());
let conn = Self::make_connection(&persistent_path_str, &perboot_path_str)?;
+ conn.busy_handler(Some(|_| {
+ std::thread::sleep(std::time::Duration::from_micros(50));
+ true
+ }))
+ .context("In KeystoreDB::new: Failed to set busy handler.")?;
Self::init_tables(&conn)?;
Ok(Self { conn })