project-nomad/admin/app/services
chriscrosstalk 2159c9dec6
fix(downloads): let interrupted content downloads resume (#1202)
doResumableDownload already implements resume - stats the .tmp, sends a
Range header, handles a server that ignores it. The code was unreachable
for ZIMs because every dispatch site passed forceNew: true, which skips
the partial-file check and opens the stream with 'w' instead of 'a', so
an interrupted 12.5 GB Wikipedia download truncated and restarted at
byte 0. Maps already do this correctly (map_service.ts:681, "so retries
resume partial downloads"); ZIMs never got the same treatment.

Worse in combination with attempts: 10 - every retry also restarted from
zero, so a flaky connection re-downloaded the whole file up to ten times.

Drop forceNew from the content-download dispatch sites (it already
defaults to false) and add the guard that enabling resume requires: a
.tmp larger than the file now on the server cannot be a prefix of it,
because openZIM re-publishes builds under the same name. Resuming would
request a range past the end, 416 on every attempt, and never delete the
.tmp - so the download could never recover on its own.

Verified on a test appliance: a 470 MB partial survived a container
restart and continued rather than truncating, and a planted oversized
.tmp was discarded with the file then downloading to its exact size.

Refs #1201
2026-08-04 03:40:01 +00:00
..
app_auto_update_service.ts
auto_update_service.ts
benchmark_service.ts fix(benchmark): don't submit unresolved PCI ids as the GPU model (#1165) 2026-08-04 03:39:58 +00:00
benchmark_telemetry.ts
chat_service.ts
collection_manifest_service.ts feat: support gated downloads for self-hosted curated content (#1172) 2026-08-04 03:39:55 +00:00
collection_update_service.ts fix(downloads): let interrupted content downloads resume (#1202) 2026-08-04 03:40:01 +00:00
condition_service.ts
container_registry_service.ts
content_auto_update_service.ts
countries_service.ts
creator_pack_service.ts fix(downloads): let interrupted content downloads resume (#1202) 2026-08-04 03:40:01 +00:00
custom_app_guard.ts
docker_service.ts
docs_service.ts docs: add an in-app Drug Reference guide (#1161) 2026-08-04 03:39:58 +00:00
download_service.ts fix(downloads): don't 500 the jobs endpoint on an orphaned BullMQ job (#1191) 2026-08-04 03:39:56 +00:00
drug_reference_service.ts
kiwix_catalog_service.ts
kiwix_library_service.ts
map_service.ts
nomad_md_service.ts
ollama_service.ts
queue_service.ts
rag_service.ts fix(kb): keep the collection when a file is indexed after assignment (#1200) 2026-08-04 03:40:01 +00:00
system_service.ts
system_update_service.ts
zim_extraction_service.ts
zim_service.ts fix(downloads): let interrupted content downloads resume (#1202) 2026-08-04 03:40:01 +00:00