fix: database corrupted on every startup (#40)

This commit is contained in:
DecDuck
2025-06-01 19:53:24 +10:00
committed by GitHub
parent 4ba3f71895
commit 1a81e458ed
3 changed files with 15 additions and 6 deletions
+2 -1
View File
@@ -5,7 +5,7 @@ use std::{
};
use chrono::Utc;
use log::{debug, error, info};
use log::{debug, error, info, warn};
use rustbreak::{DeSerError, DeSerializer, PathDatabase, RustbreakError};
use serde::{de::DeserializeOwned, Serialize};
use url::Url;
@@ -99,6 +99,7 @@ fn handle_invalid_database(
games_base_dir: PathBuf,
cache_dir: PathBuf,
) -> rustbreak::Database<Database, rustbreak::backend::PathBackend, DropDatabaseSerializer> {
warn!("{}", _e);
let new_path = {
let time = Utc::now().timestamp();
let mut base = db_path.clone();
+1
View File
@@ -176,6 +176,7 @@ pub mod data {
pub auth: Option<DatabaseAuth>,
pub base_url: String,
pub applications: DatabaseApplications,
#[serde(skip)]
pub prev_database: Option<PathBuf>,
pub cache_dir: PathBuf,
pub compat_info: Option<DatabaseCompatInfo>,