mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-03 00:14:21 +01:00
stress: Don't die if database is locked during integrity check
This commit is contained in:
@@ -559,13 +559,19 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
||||
const INTEGRITY_CHECK_INTERVAL: usize = 100;
|
||||
if query_index % INTEGRITY_CHECK_INTERVAL == 0 {
|
||||
let mut res = conn.query("PRAGMA integrity_check", ()).await.unwrap();
|
||||
if let Some(row) = res.next().await? {
|
||||
let value = row.get_value(0).unwrap();
|
||||
if value != "ok".into() {
|
||||
panic!("integrity check failed: {:?}", value);
|
||||
match res.next().await {
|
||||
Ok(Some(row)) => {
|
||||
let value = row.get_value(0).unwrap();
|
||||
if value != "ok".into() {
|
||||
panic!("integrity check failed: {:?}", value);
|
||||
}
|
||||
}
|
||||
Ok(None) => {
|
||||
panic!("integrity check failed: no rows");
|
||||
}
|
||||
Err(e) => {
|
||||
println!("Error performing integrity check: {e}");
|
||||
}
|
||||
} else {
|
||||
panic!("integrity check failed: no rows");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user