Optimize Last.fm popularity lookups with light and full modes

This commit is contained in:
Aleksandr Bogomiakov committed 2026-10-16 00:59:09 +01:00
1 parent 2b3b50f7af
commit bd1d3a4ebc
11 files changed
+955 -185

No files matched your search

+15
View File
@@ -110,6 +110,8 @@ pub struct ArtworkBackfillRunRequest {
overwrite_existing: bool,
}
pub type LastfmPopularityRunRequest = crate::jobs::lastfm_popularity::LastfmPopularityOptions;
#[derive(Debug, Deserialize)]
pub(super) struct UpdateLibraryItemRequest {
kind: String,
@@ -1734,6 +1736,19 @@ pub async fn run_metadata_backfill(
Json(JobRunStartedDto { ok: true, run_id }).into_response()
}
pub async fn run_lastfm_popularity(
session: Session,
db: Database,
pool: &PgPool,
Json(options): Json<LastfmPopularityRunRequest>,
) -> cot::Result<cot::response::Response> {
if let Err(response) = require_admin_json(&session, &db).await {
return Ok(response);
}
let run_id = super::start_lastfm_popularity(&db, pool, options).await?;
Json(JobRunStartedDto { ok: true, run_id }).into_response()
}
pub async fn run_artwork_backfill(
session: Session,
db: Database,