Expand description
Stop signalling for in-flight downloads.
TRACES: UR-055 | DR-168
Pausing and cancelling used to be database-only: pause_download wrote
status = 'paused' and nothing else. No cancellation existed anywhere in the
download stack — no token, no flag, no abort — so the streaming task kept
running, kept writing bytes, and on finishing overwrote the row with
completed or failed. The row flicked to “paused” and then undid itself,
which is precisely the reported “pause does not work”.
This is the missing half: a flag per in-flight download that the worker reads
between chunks. Setting it makes the worker return Stopped promptly and
leave the .part file intact, which is what lets a resume pick up from
where it stopped via the existing HTTP Range request.
Kept as a module-level registry rather than on DownloadManager because the
two sides never meet: the command handler holds the manager’s lock, while the
worker runs detached inside tauri::async_runtime::spawn with no access to
Tauri state. A registry both can reach is the smallest thing that works.