Home

dev / openkara

publicthedavidweng/OpenKara· sync paused
Overview Code History Branches Pull requestsIssuesInsights
main
HomeOverview Code PRsIssues

fix(bootstrap): resume artifact downloads instead of restarting them (#281)

2 months ago

dc83f4f
Authored
Davy7/26/2026, 11:34:13 PM
Reported in #270: about an hour of downloading, ~30% of the model
fetched, then "failed while streaming ONNX model download" and
everything discarded.

The transfer was a single GET streamed to a temp file, with the temp
file deleted on any error and no retry. The per-read timeout is 120s, so
one network stall on a slow link threw away every byte already fetched -
and the next attempt started from zero.

Retry up to five times, resuming with a Range request. The running hash
keeps its state across attempts because no downloaded byte is discarded,
so a resume costs a round trip rather than the megabytes already on
disk.

Two cases the naive version gets wrong, both covered by tests:

- A body that ends short is what a dropped connection looks like to the
  reader. That is now a retry from the last byte, not a truncation
  error - it is the exact failure this exists for.
- A server that ignores Range answers 200 with the whole body. Appending
  it would corrupt the file, so the transfer restarts instead.

Parent16ec9b3

2 files changed
  • src-tauri/src/separator/artifacts.rs+161−34
  • src-tauri/tests/artifact_download_resume.rs+95−0