apply cache tll properly and slightly change date rendering

This commit is contained in:
slonkazoid 2024-12-29 20:01:25 +03:00
parent c9bbb5234e
commit 01bc3ae4ae
Signed by: slonk
SSH key fingerprint: SHA256:tbZfJX4IOvZ0LGWOWu5Ijo8jfMPi78TU7x1VoEeCIjM
2 changed files with 9 additions and 2 deletions

View file

@ -33,6 +33,7 @@ pub struct CacheValue {
pub struct Cache {
map: HashMap<CacheKey, CacheValue>,
version: u16,
#[serde(skip)]
ttl: Option<NonZeroU64>,
}
@ -278,5 +279,10 @@ pub(crate) async fn load_cache(config: &CacheConfig) -> Result<Cache, eyre::Repo
buf
};
bitcode::deserialize(serialized.as_slice()).context("failed to parse cache")
let mut cache: Cache =
bitcode::deserialize(serialized.as_slice()).context("failed to parse cache")?;
cache.ttl = config.ttl;
Ok(cache)
}

View file

@ -1,7 +1,8 @@
function replaceDates() {
for (let el of document.querySelectorAll(".date-rfc3339")) {
let date = new Date(Date.parse(el.textContent));
el.title = el.textContent;
el.textContent = date.toLocaleString();
el.classList.remove("date-rfc3339");
el.classList.replace("date-rfc3339", "tooltipped");
}
}