update
This commit is contained in:
parent
95c5592170
commit
9a9e77a3bb
4 changed files with 10 additions and 6 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -2010,6 +2010,7 @@ name = "synthwave"
|
|||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bcrypt",
|
||||
"chrono",
|
||||
"data-encoding",
|
||||
"env_logger",
|
||||
"log",
|
||||
|
|
|
@ -17,3 +17,4 @@ data-encoding = "2.6.0"
|
|||
rand = "0.8.5"
|
||||
env_logger = "0.11.5"
|
||||
log = "0.4.22"
|
||||
chrono = "0.4.38"
|
||||
|
|
12
src/cache.rs
12
src/cache.rs
|
@ -32,7 +32,7 @@ impl RouteCache {
|
|||
let lock = self.inner.read().await;
|
||||
if let Some(inner_map) = lock.get(route) {
|
||||
if let Some(cached_value) = inner_map.get(id) {
|
||||
log::trace!("Using cached value for {route} / {id}");
|
||||
log::info!("Using cached value for {route} / {id}");
|
||||
return cached_value.clone().unwrap();
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ impl RouteCache {
|
|||
// If the value was not found, acquire a write lock to insert the computed value.
|
||||
let mut lock = self.inner.write().await;
|
||||
|
||||
log::trace!("Computing value for {route} / {id}");
|
||||
log::info!("Computing value for {route} / {id}");
|
||||
let computed = generator().await;
|
||||
|
||||
lock.entry(route.to_string())
|
||||
|
@ -55,7 +55,7 @@ impl RouteCache {
|
|||
let lock = self.inner.read().await;
|
||||
if let Some(inner_map) = lock.get(route) {
|
||||
if let Some(cached_value) = inner_map.get(id) {
|
||||
log::trace!("Using cached value for {route} / {id}");
|
||||
log::info!("Using cached value for {route} / {id}");
|
||||
return cached_value.clone();
|
||||
}
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ impl RouteCache {
|
|||
let lock = self.inner.read().await;
|
||||
if let Some(inner_map) = lock.get(route) {
|
||||
if let Some(cached_value) = inner_map.get(id) {
|
||||
log::trace!("Using cached value for {route} / {id}");
|
||||
log::info!("Using cached value for {route} / {id}");
|
||||
return cached_value.clone();
|
||||
}
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ impl RouteCache {
|
|||
// If the value was not found, acquire a write lock to insert the computed value.
|
||||
let mut lock = self.inner.write().await;
|
||||
|
||||
log::trace!("Computing value for {route} / {id}");
|
||||
log::info!("Computing value for {route} / {id}");
|
||||
let computed = generator().await;
|
||||
|
||||
lock.entry(route.to_string())
|
||||
|
@ -95,7 +95,7 @@ impl RouteCache {
|
|||
pub async fn insert(&self, route: &str, id: &str, value: String) {
|
||||
let mut lock = self.inner.write().await;
|
||||
|
||||
log::trace!("Inserting value for {route} / {id}");
|
||||
log::info!("Inserting value for {route} / {id}");
|
||||
|
||||
lock.entry(route.to_string())
|
||||
.or_insert_with(HashMap::new)
|
||||
|
|
|
@ -19,6 +19,7 @@ pub struct Track {
|
|||
pub _id: String,
|
||||
pub path: String,
|
||||
pub title: String,
|
||||
pub date_added: i64,
|
||||
pub album_id: Option<Reference>,
|
||||
pub artist_id: Option<Reference>,
|
||||
pub meta: Option<AudioMetadata>,
|
||||
|
@ -30,6 +31,7 @@ impl Track {
|
|||
_id: uuid::Uuid::new_v4().to_string(),
|
||||
path: data.get("path").unwrap().as_str().unwrap().to_string(),
|
||||
title: data.get("title").unwrap().as_str().unwrap().to_string(),
|
||||
date_added: chrono::Utc::now().timestamp(),
|
||||
album_id: None,
|
||||
artist_id: None,
|
||||
meta: data.get("meta").map(|x| AudioMetadata(x.clone())),
|
||||
|
|
Loading…
Reference in a new issue