Keystore 2.0: Install database busy handler.

Make keystore DB poll every 50us for the database lock.

Test: N/A
Change-Id: Ibb6c8d438e4b3d99d80671b6720baad23cc17a0d
This commit is contained in:
Janis Danisevskis 2021-01-29 08:38:11 -08:00
parent f3caf2698b
commit aea2734a7c

View file

@ -617,6 +617,11 @@ impl KeystoreDB {
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 })