Skip to content

fix(updater): download updates through the queue (pause/resume, no crash) - #18

Closed
arousi wants to merge 4 commits into
billysams21:devfrom
arousi:fix/updater-via-queue
Closed

fix(updater): download updates through the queue (pause/resume, no crash)#18
arousi wants to merge 4 commits into
billysams21:devfrom
arousi:fix/updater-via-queue

Conversation

@arousi

@arousi arousi commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Reworks the auto-updater so a new version downloads through the normal download queue instead of a separate modal downloader.

Problem

The old UpdateDownloaderDialog streamed the whole release zip in a modal loop while firing per-chunk cross-thread progress updates. On a large release (~205 MB), concurrent with the live-speed-graph update_ui, it could crash the app mid-download.

Change

  • An available update is added to the queue as a DownloadTask (is_update). The user starts it like any download and can pause/resume it (Range-resume). It downloads to the visible Save-To folder.
  • On completion the app offers Install now (restart) or Install on next open; a deferred update is applied on the next launch. Update tasks are never auto-extracted.
  • execute_update_apply_downloaded_update(zip_path): the robust extract → robocopy dir-swap → marker-verify → rollback flow is unchanged; it just consumes the already-downloaded zip. The crash-prone modal downloader is removed.
  • Guards a stale completed-update task whose file is gone (no phantom prompt / re-download works).

Backward compatibility

Additive. DownloadTask gains is_update/update_version (persisted). No new dependencies.

Verified

Offscreen smoke: update task queues, persists, completes → install prompt, and pending-on-next-open. Scheduler/button unit suites still green. (GUI+network paths are integration-tested via smoke, not unit tests.)

Note: this and the "general direct-URL downloads" PR both touch the top of download_worker; whichever merges second will need a trivial conflict resolution there.

arousi added 4 commits August 22, 2026 06:16
The old modal UpdateDownloaderDialog streamed the whole release zip while
flooding the GUI thread with per-chunk cross-thread progress calls; on a
large (205MB) release, concurrent with the live-graph update_ui, it could
crash the app mid-download.

Route updates through the existing, proven download engine instead:
- an available update is added to the normal queue as a DownloadTask
  (is_update); the user starts it and can pause/resume (Range-resume) it
  like any other download
- update tasks bypass the Cloudflare/CAPTCHA direct-link step and are never
  auto-extracted
- on completion the app offers Install now (restart) or Install on next
  open; a deferred update is applied via _check_pending_update on launch
- execute_update -> _apply_downloaded_update(zip_path): the robust
  extract -> robocopy swap -> marker-verify -> rollback flow is unchanged,
  it just consumes the already-downloaded zip

Removes the crash-prone modal download path entirely.
Root cause of the 'added but never progresses / connection timed out':
the queued update task ran through download_worker on a manager-spawned
thread and reused the shared curl_cffi self.dl_session. That session
(built on the main thread) hangs with curl (28) for a plain request that
never went through the nodriver/get_direct_link path first — normal
downloads work only because get_direct_link runs before the transfer.

Route update tasks through a dedicated _download_update_file() using urllib
(stdlib): supports Range-resume, pause/cancel, progress, and a 416
already-complete short-circuit. Confirmed progressing via the real manager
path where curl deterministically hung. Also stop a previously failed
update task from blocking a fresh re-offer.
Update downloads were written to a hidden ~/.silverspoon_updates folder, so
users couldn't find the completed file. Download to the same Save-To
directory as every other download (…/SilverSpoon Update <version>/), so it's
visible, consistent, and persists for an install-on-next-open.
Guard the completion prompt and the re-offer dedup on os.path.exists(filepath)
so a stale Completed update task (file deleted/moved) neither fires a phantom
install prompt nor blocks re-downloading.
@arousi

arousi commented Aug 22, 2026

Copy link
Copy Markdown
Contributor Author

cmon guys, we got work todo. next feature should be throttling download like any other idm, number of concurrent, max speed total, max speed per file, etc.
generlizing this project a bit towards general use would gain it real support by new adopters. good luck with reviews, i am here if you need me for any findings.

arousi pushed a commit to arousi/SilverSpoon that referenced this pull request Sep 8, 2026
…, status-pill, ci-build

Supersedes the earlier drafts on dev with the rebased PR branches (billysams21#18-billysams21#22 on
upstream), merged on top of v1.5.1. Tree is identical to main + the stack.
@arousi

arousi commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #27, which carries this change together with the other four fixes on top of v1.5.1 as a single PR from my fork's main.

@arousi arousi closed this Sep 8, 2026
@arousi
arousi deleted the fix/updater-via-queue branch September 8, 2026 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant