Skip to main content

pause_download

Function pause_download 

Source
pub async fn pause_download(
    db: State<'_, DatabaseWrapper>,
    download_id: i64,
) -> Result<(), String>
Expand description

Pause a download.

Writing status = 'paused' is only half of it, and used to be all of it: the streaming task knew nothing about the row and kept running, then overwrote it with completed/failed when it finished. The row flicked to “paused” and undid itself — the reported “pause does not work”. Signalling the worker is what actually stops the bytes; it leaves the .part file in place so resume_download can continue from it.

A queued (not yet started) download has no worker to signal, and the status write alone is enough — the pump skips anything that is not pending.

TRACES: UR-055 | DR-168