Skip to content

Commit

Permalink
fix: try without a async join
Browse files Browse the repository at this point in the history
  • Loading branch information
lostb1t committed Jul 10, 2024
1 parent e6cd7f2 commit edc8ed7
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 20 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 12 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
hyper = { version = "1.1", features = ["full"] }
tokio = { version = "1.38.0", features = ["full", "tracing"] }
lazy_static = "1.4.0"
lazy_static = "1.4"
anyhow = "1.0"
yaserde_derive = "0.10.0"
yaserde = "0.10.0"
derive_more = "0.99.17"
yaserde_derive = "0.10"
yaserde = "0.10"
derive_more = "0.99"
url = "2.4.0"
tracing = "0.1.37"
strum_macros = "0.24.3"
strum = "0.24.1"
itertools = "0.10.5"
pathetic = "0.3.0"
bytes = "1.4.0"
mime = "0.3.16"
tracing = "0.1"
strum_macros = "0.24"
strum = "0.24"
itertools = "0.10"
pathetic = "0.3"
bytes = "1.4"
mime = "0.3"
async-trait = "0.1"
futures-util = "0.3"
opentelemetry = { version = "0.19.0", features = [ "trace", "rt-tokio" ] }
Expand All @@ -37,7 +37,7 @@ salvo = { version = "0.68", features = ["anyhow", "websocket", "proxy", "cors",
reqwest = { version = "0.12", features = ["gzip", "json", "blocking"] }
http-body-util = "0.1.2"
once_cell = "1.18.0"
moka = { version = "0.11.2", features = ["future"] }
moka = { version = "0.11", features = ["future"] }
#tonic = {version = "0.8.0", features = ["tls", "tls-roots"]}
async-recursion = "1.0.4"
console-subscriber = "0.1.10"
Expand Down
4 changes: 2 additions & 2 deletions src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ impl CacheManager {
/// Clears out the entire cache.
pub async fn clear(&self) -> anyhow::Result<()> {
self.inner.invalidate_all();
self.inner.sync();
//self.inner.sync();
Ok(())
}

Expand Down Expand Up @@ -147,7 +147,7 @@ impl CacheManager {

pub async fn delete(&self, cache_key: &str) -> anyhow::Result<()> {
self.inner.invalidate(cache_key).await;
self.inner.sync();
//self.inner.sync();
Ok(())
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/plex_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ impl PlexClient {
container: MediaContainerWrapper<MediaContainer>,
) {
self.cache.insert(cache_key, container).await;
self.cache.sync();
//self.cache.sync();
}

fn generate_cache_key(&self, name: String) -> String {
Expand Down
49 changes: 47 additions & 2 deletions src/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ impl TransformBuilder {
}

// TODO: join async filters
pub async fn apply_to(
pub async fn apply_to_old(
self,
container: &mut MediaContainerWrapper<MediaContainer>,
) {
Expand All @@ -157,8 +157,53 @@ impl TransformBuilder {
)
},
);

future::join_all(futures).await;
//for k in container.media_container.children_mut()

// dont use join as it needs ti be executed in order
// let l = std::cell::RefCell::new(&mut container.media_container);
container.media_container = t
.transform_mediacontainer(
container.media_container.clone(),
self.plex_client.clone(),
self.options.clone(),
)
.await;
// dbg!(container.media_container.size);
}

// filter behind transform as transform can load in additional data
let children = container.media_container.children_mut();
let new_children = self.apply_to_metadata(children).await;
container.media_container.set_children(new_children);

if container.media_container.size.is_some() {
container.media_container.size = Some(
container
.media_container
.children_mut()
.len()
.try_into()
.unwrap(),
);
}
}

pub async fn apply_to(
self,
container: &mut MediaContainerWrapper<MediaContainer>,
) {
for t in self.transforms.clone() {

for child in container.media_container.children_mut() {
t.transform_metadata(
child,
self.plex_client.clone(),
self.options.clone(),
).await;
}
//future::join_all(futures).await;

// dont use join as it needs ti be executed in order
// let l = std::cell::RefCell::new(&mut container.media_container);
Expand Down

0 comments on commit edc8ed7

Please sign in to comment.