Skip to content

Commit 4ab92ac

Browse files
authored
Merge pull request #116 from silicon-heaven/parse-user-id-from-notifications
Parse user id from notifications
2 parents ed33e7e + 4a17aa0 commit 4ab92ac

6 files changed

Lines changed: 101 additions & 65 deletions

File tree

Cargo.lock

Lines changed: 47 additions & 45 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "historyprovider"
33
description = "historyprovider-rs"
44
license = "MIT"
55
repository = "https://github.com/silicon-heaven/historyprovider-rs"
6-
version = "2.10.3"
6+
version = "2.11.0"
77
edition = "2024"
88

99
[profile.release]
@@ -18,8 +18,8 @@ name = "hp"
1818
[dependencies]
1919
tokio = { version = "1.52.3", features = ["io-util", "macros", "net", "rt", "rt-multi-thread", "signal", "sync", "time"], default-features = false }
2020
shvproto = "6.1.9"
21-
shvrpc = { version = "15.0", features = ["journal"] }
22-
shvclient = { version = "5.1", features = ["tokio"] }
21+
shvrpc = { version = "16.0", features = ["journal"] }
22+
shvclient = { version = "6.0", features = ["tokio"] }
2323
futures = "0.3.32"
2424
log = "0.4.29"
2525
clap = { version = "4.6.0", features = ["derive"] }
@@ -48,5 +48,5 @@ size = { version = "0.5.0", features = ["serde"] }
4848
[dev-dependencies]
4949
async-broadcast = "0.7.2"
5050
async-trait = "0.1.80"
51-
shvclient = { version = "5.1", features = ["mocking", "tokio"] }
51+
shvclient = { version = "6.0", features = ["mocking", "tokio"] }
5252
tempfile = "3.27.0"

src/cleanup.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub(crate) async fn collect_log_files(dir: impl AsRef<Path>) -> io::Result<Vec<L
2828

2929
if metadata.is_dir() {
3030
dirs.push(path);
31-
} else if metadata.is_file() && path.extension().is_some_and(|ext| ext == "log2" || ext == "log3")
31+
} else if metadata.is_file() && path.to_str().is_some_and(|p| p.ends_with(".log2") || p.ends_with(".log3"))
3232
&& let (Some(file_name), Some(parent)) = (path.file_name(), path.parent()) {
3333
result.push(LogFile {
3434
name: file_name.into(),
@@ -47,7 +47,7 @@ pub(crate) async fn cleanup_log_files(dir: impl AsRef<Path>, size_limit: u64, da
4747
let files = collect_log_files(dir).await?;
4848
let mut files_size: u64 = files.iter().map(|f| f.size).sum();
4949

50-
info!("log2 files size: {files_size}, size limit: {size_limit}, days_to_keep: {days_to_keep}");
50+
info!("log files size: {files_size}, size limit: {size_limit}, days_to_keep: {days_to_keep}");
5151
if files_size < size_limit {
5252
info!("Size limit not hit, nothing to cleanup");
5353
return Ok(());
@@ -76,7 +76,7 @@ pub(crate) async fn cleanup_log_files(dir: impl AsRef<Path>, size_limit: u64, da
7676
deletable_files.extend(group
7777
.into_iter()
7878
.skip(2)
79-
.filter(|log_file| if log_file.name.ends_with(".log2") {
79+
.filter(|log_file| if log_file.name.to_string_lossy().ends_with(".log2") {
8080
log_file.name < oldest_log2_file_to_keep
8181
} else {
8282
log_file.name < oldest_log3_file_to_keep

0 commit comments

Comments
 (0)