Skip to main content

resolve_pending_download_urls

Function resolve_pending_download_urls 

Source
pub(crate) async fn resolve_pending_download_urls<F, Fut>(
    db_service: &Arc<RusqliteService>,
    target_dir: &str,
    only_ids: Option<&[i64]>,
    resolve: F,
) -> Result<ResumeQueuedResult, String>
where F: Fn(String, String, String) -> Fut, Fut: Future<Output = Option<String>>,
Expand description

Core of resume_queued_downloads, factored out for testing: select every pending/stream_url IS NULL row, resolve each via resolve (returning None leaves the row pending), and heal the row so the pump can start it. The resolve closure receives (item_id, media_type, quality_preset).

only_ids restricts the sweep to specific download rows. Reconnect passes None and heals everything; a bulk enqueue (an album, say) passes the rows it just created, so clicking download on one album cannot also start every unrelated row that has been sitting pending.