From 7acde1948d6a9ab40db42d53836d194c69fcb668 Mon Sep 17 00:00:00 2001 From: Louis <836250617@qq.com> Date: Sun, 21 Jul 2024 15:19:22 +0800 Subject: [PATCH] A bug between epoches of fav faemon that status won't be saved. --- CHANGELOG.md | 3 ++- Cargo.lock | 6 +++--- Cargo.toml | 6 +++--- fav_cli/src/bili/action.rs | 1 + fav_core/Cargo.toml | 2 +- fav_core/src/local.rs | 2 +- 6 files changed, 11 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 518d4ed..bd9136b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,9 +9,10 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com --> ## [Unreleased] -### [0.2.30] - 2024-06-18 +## [0.2.30] - 2024-06-18 - fix: wrong hint of `fav status -h` +- fix: status won't be saved after each epoch of fav daemon ## [0.2.29] - 2024-06-18 diff --git a/Cargo.lock b/Cargo.lock index 4e093cd..7dd9466 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -371,7 +371,7 @@ checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" [[package]] name = "fav" -version = "0.2.29" +version = "0.2.30" dependencies = [ "fav_cli", "tokio", @@ -381,7 +381,7 @@ dependencies = [ [[package]] name = "fav_cli" -version = "0.2.29" +version = "0.2.30" dependencies = [ "chrono", "clap", @@ -396,7 +396,7 @@ dependencies = [ [[package]] name = "fav_core" -version = "0.1.3" +version = "0.1.4" dependencies = [ "bitflags 2.6.0", "fav_derive", diff --git a/Cargo.toml b/Cargo.toml index 4ee62c3..22c48fe 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ resolver = "2" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [workspace.package] -version = "0.2.29" +version = "0.2.30" authors = ["Louis <836250617@qq.com>"] description = "Back up your favorite online resources with CLI." license = "MIT" @@ -14,10 +14,10 @@ repository = "https://github.com/kingwingfly/fav" documentation = "" [workspace.dependencies] -fav_core = { path = "fav_core", version = "0.1.3" } +fav_core = { path = "fav_core", version = "0.1.4" } fav_derive = { path = "fav_derive", version = "0.0.2" } fav_utils = { path = "fav_utils", version = "0.0.12" } -fav_cli = { path = "fav_cli", version = "0.2.29" } +fav_cli = { path = "fav_cli", version = "0.2.30" } [profile.release] lto = "fat" diff --git a/fav_cli/src/bili/action.rs b/fav_cli/src/bili/action.rs index 6e27d14..239b7a6 100644 --- a/fav_cli/src/bili/action.rs +++ b/fav_cli/src/bili/action.rs @@ -205,6 +205,7 @@ pub(super) async fn daemon(sets: &mut BiliSets, interval: u64) -> FavCoreResult< loop { tokio::select! { res = pull_all(sets), if fire => { + sets.write()?; if let Err(e) = res { error!("{}", e); } diff --git a/fav_core/Cargo.toml b/fav_core/Cargo.toml index 484ebb8..c10eb9d 100644 --- a/fav_core/Cargo.toml +++ b/fav_core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fav_core" -version = "0.1.3" +version = "0.1.4" authors.workspace = true description = "Fav's core crate; A collection of traits." license.workspace = true diff --git a/fav_core/src/local.rs b/fav_core/src/local.rs index 5956ff9..67df2e2 100644 --- a/fav_core/src/local.rs +++ b/fav_core/src/local.rs @@ -35,7 +35,7 @@ pub trait PathInfo { pub trait ProtoLocal: PathInfo + MessageFull { /// Write the protobuf to file, which is at `PathInfo::PATH` /// Create the parent directory if not exists - fn write(self) -> FavCoreResult<()> { + fn write(&self) -> FavCoreResult<()> { let path = std::path::PathBuf::from(Self::PATH); if let Some(parent) = path.parent() { std::fs::create_dir_all(parent)?;