Skip to content

Commit

Permalink
fix(backend): respect cache when making progress updates from integra…
Browse files Browse the repository at this point in the history
…tions
  • Loading branch information
IgnisDa committed Oct 11, 2024
1 parent d7a4922 commit 619a815
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion crates/services/importer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ impl ImporterService {
}
ImportSource::Jellyfin => jellyfin::import(input.jellyfin.unwrap()).await.unwrap(),
};
let details = process_import(&user_id, import, &self.0).await?;
let details = process_import(&user_id, false, import, &self.0).await?;
self.finish_import_job(db_import_job, details).await?;
deploy_background_job(
&user_id,
Expand Down
6 changes: 3 additions & 3 deletions crates/services/integration/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ impl IntegrationService {
integration: integration::Model,
updates: ImportResult,
) -> GqlResult<()> {
let mut updates = updates;
updates.metadata.iter_mut().for_each(|media| {
let mut import = updates;
import.metadata.iter_mut().for_each(|media| {
media.seen_history.retain(|update| match update.progress {
Some(progress) if progress < integration.minimum_progress.unwrap() => {
ryot_log!(
Expand All @@ -66,7 +66,7 @@ impl IntegrationService {
}
});
});
if let Err(err) = process_import(&integration.user_id, updates, &self.0).await {
if let Err(err) = process_import(&integration.user_id, true, import, &self.0).await {
ryot_log!(debug, "Error updating progress: {:?}", err);
} else {
let mut to_update: integration::ActiveModel = integration.into();
Expand Down
3 changes: 2 additions & 1 deletion crates/utils/dependent/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1866,6 +1866,7 @@ async fn create_collection_and_add_entity_to_it(

pub async fn process_import(
user_id: &String,
respect_cache: bool,
import: ImportResult,
ss: &Arc<SupportingService>,
) -> Result<ImportResultResponse> {
Expand Down Expand Up @@ -1944,7 +1945,7 @@ pub async fn process_import(
change_state: None,
},
user_id,
false,
respect_cache,
ss,
)
.await
Expand Down

0 comments on commit 619a815

Please sign in to comment.