cache: delete cache if corrupted
This commit is contained in:
parent
e02e1ae26a
commit
bacfbf0791
|
@ -45,7 +45,7 @@ pub(crate) mod internal {
|
||||||
|
|
||||||
pub(crate) fn get_cache() -> Result<Persy, Box<dyn Error>> {
|
pub(crate) fn get_cache() -> Result<Persy, Box<dyn Error>> {
|
||||||
let cache_dir = get_cache_dir()?;
|
let cache_dir = get_cache_dir()?;
|
||||||
let conn = Persy::open_or_create_with(
|
match Persy::open_or_create_with(
|
||||||
&cache_dir.join("librashader.db.1"),
|
&cache_dir.join("librashader.db.1"),
|
||||||
Config::new(),
|
Config::new(),
|
||||||
|persy| {
|
|persy| {
|
||||||
|
@ -53,8 +53,14 @@ pub(crate) mod internal {
|
||||||
tx.commit()?;
|
tx.commit()?;
|
||||||
Ok(())
|
Ok(())
|
||||||
},
|
},
|
||||||
)?;
|
) {
|
||||||
Ok(conn)
|
Ok(conn) => Ok(conn),
|
||||||
|
Err(e) => {
|
||||||
|
let path = &cache_dir.join("librashader.db.1");
|
||||||
|
let _ = std::fs::remove_file(path).ok();
|
||||||
|
Err(e)?
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn get_blob(
|
pub(crate) fn get_blob(
|
||||||
|
|
Loading…
Reference in a new issue