fix issues with recording statistical data (closes #6)
This commit is contained in:
parent
1ae0533f2d
commit
eb99095d3c
4 changed files with 5 additions and 4 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
|
@ -530,7 +530,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "enex-rcache"
|
name = "enex-rcache"
|
||||||
version = "0.2.0"
|
version = "0.2.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-web",
|
"actix-web",
|
||||||
"actix-web-httpauth",
|
"actix-web-httpauth",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "enex-rcache"
|
name = "enex-rcache"
|
||||||
version = "0.2.0"
|
version = "0.2.1"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,7 @@ pub async fn put_cache_item(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
shared.stats.successful_writes += 1;
|
shared.stats.successful_writes += 1;
|
||||||
|
shared.stats.cache_size += size;
|
||||||
update_boundary_items(&mut shared.stats, &shared.lru_cache);
|
update_boundary_items(&mut shared.stats, &shared.lru_cache);
|
||||||
});
|
});
|
||||||
debug!("Created cache item {}", hash.as_str());
|
debug!("Created cache item {}", hash.as_str());
|
||||||
|
|
|
||||||
|
|
@ -20,13 +20,13 @@ pub fn update_boundary_items(stats: &mut Stats, entries: &WeightedLRUCache<Cache
|
||||||
for (_, value) in entries.iter() {
|
for (_, value) in entries.iter() {
|
||||||
if stats
|
if stats
|
||||||
.oldest_entry_at
|
.oldest_entry_at
|
||||||
.is_none_or(|oldest_entry| oldest_entry < value.meta.create_at)
|
.is_none_or(|oldest_entry| oldest_entry > value.meta.create_at)
|
||||||
{
|
{
|
||||||
stats.oldest_entry_at = Some(value.meta.create_at);
|
stats.oldest_entry_at = Some(value.meta.create_at);
|
||||||
}
|
}
|
||||||
if stats
|
if stats
|
||||||
.newest_entry_at
|
.newest_entry_at
|
||||||
.is_none_or(|newest_entry| newest_entry > value.meta.create_at)
|
.is_none_or(|newest_entry| newest_entry < value.meta.create_at)
|
||||||
{
|
{
|
||||||
stats.newest_entry_at = Some(value.meta.create_at);
|
stats.newest_entry_at = Some(value.meta.create_at);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue