Skip to main content

pump_download_queue

Function pump_download_queue 

Source
pub(crate) async fn pump_download_queue(
    app: AppHandle,
    db_service: Arc<RusqliteService>,
    active_downloads: Arc<Mutex<HashSet<i64>>>,
)
Expand description

Start as many pending downloads as there are free concurrency slots.

Picks the highest-priority pending rows that have a persisted stream_url (FIFO within a priority), registers each, flips it to downloading, and spawns a worker. Each spawned worker calls this again on completion/failure, so the queue drains itself without any frontend involvement.