Skip to content

Commit

Permalink
perf(backend): only fetch yank integrations
Browse files Browse the repository at this point in the history
  • Loading branch information
IgnisDa committed Sep 25, 2024
1 parent b59a2ea commit 79dacd2
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions crates/services/miscellaneous/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3004,6 +3004,7 @@ impl MiscellaneousService {
}
let integrations = Integration::find()
.filter(integration::Column::UserId.eq(user_id))
.filter(integration::Column::Lot.eq(IntegrationLot::Yank))
.all(&self.db)
.await?;
let mut progress_updates = vec![];
Expand All @@ -3015,24 +3016,19 @@ impl MiscellaneousService {
ryot_log!(debug, "Integration {} is disabled", integration.id);
continue;
}
let specifics = integration.clone().provider_specifics.unwrap();
let integration_input = match integration.provider {
IntegrationProvider::Audiobookshelf => {
let specifics = integration.clone().provider_specifics.unwrap();
IntegrationType::Audiobookshelf(
specifics.audiobookshelf_base_url.unwrap(),
specifics.audiobookshelf_token.unwrap(),
self.get_isbn_service().await.unwrap(),
)
}
IntegrationProvider::Komga => {
let specifics = integration.clone().provider_specifics.unwrap();
IntegrationType::Komga(
specifics.komga_base_url.unwrap(),
specifics.komga_username.unwrap(),
specifics.komga_password.unwrap(),
specifics.komga_provider.unwrap(),
)
}
IntegrationProvider::Audiobookshelf => IntegrationType::Audiobookshelf(
specifics.audiobookshelf_base_url.unwrap(),
specifics.audiobookshelf_token.unwrap(),
self.get_isbn_service().await.unwrap(),
),
IntegrationProvider::Komga => IntegrationType::Komga(
specifics.komga_base_url.unwrap(),
specifics.komga_username.unwrap(),
specifics.komga_password.unwrap(),
specifics.komga_provider.unwrap(),
),
_ => continue,
};
let response = integration_service
Expand Down

0 comments on commit 79dacd2

Please sign in to comment.