Multithreaded parallel downloads with auto-scroll and queue UI controls - #1885
Multithreaded parallel downloads with auto-scroll and queue UI controls#1885SirBiggin wants to merge 5 commits into
Conversation
# Conflicts: # Source/LibationUiBase/ProcessQueue/ProcessQueueViewModel.cs
…l downloads Snapshot GetVisible() on the UI thread before handing off to Task.Run, preventing InvalidOperationException when parallel downloads modify the collection concurrently. Also fix installer script to use 64-bit dotnet. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
rmcrackan
left a comment
There was a problem hiding this comment.
Sorry it has taken me so long to get back to this.
Thanks for this - the concurrent queue loop and multi-active TrackedQueue are a solid foundation. A few gaps before this is safe to merge:
- Avalonia parity - Parallelism is on by default in shared UI code, but Avalonia has no toggle and Cancel All still only cancels
Current(seeProcessQueueControl.axaml.cs). - Abort / disk-full - Please also cancel in-flight active downloads, not just clear the pending queue.
- Safer defaults - Defaulting to
ProcessorCountis aggressive given Audible license throttling; prefer opt-in or a small default, plus a way to set the limit. - Installer script - Please drop the hardcoded
dotnet.exepath; it looks unrelated to this feature.
Also worth rebasing on current master when you get a chance.
| SpeedLimit = Configuration.Instance.DownloadSpeedLimit / 1024m / 1024; | ||
| MaxConcurrentDownloads = Configuration.Instance.MaxConcurrentDownloads; | ||
| AutoScrollQueue = Configuration.Instance.AutoScrollQueue; | ||
| MultiThreadEnabled = true; |
There was a problem hiding this comment.
Since this lives in shared UI code, Avalonia gets parallel downloads with no control to turn them off. Could we default to off (or persist the setting) and add matching Avalonia UI?
|
|
||
| if (result == ProcessBookResult.FailedAbort) | ||
| { | ||
| abortCts.Cancel(); |
There was a problem hiding this comment.
ClearQueue() stops new work, but other active downloads keep running. Could we cancel all Active items here (same as Cancel All)? Same for the disk-full path just below.
| { | ||
| var value = GetNonString(defaultValue: 0); | ||
| // Treat 0 or 1 as "use default" — 1 may have been written by an earlier bug. | ||
| return value <= 1 ? Environment.ProcessorCount : value; |
There was a problem hiding this comment.
Defaulting to ProcessorCount may trigger Audible license denials on larger machines. A small default (e.g. 2-3) and a numeric control would be safer than an on/off checkbox alone.
| dotnet publish 'LoadByOS/WindowsConfigApp/WindowsConfigApp.csproj' @publishArgs | ||
| dotnet publish 'LibationCli/LibationCli.csproj' @publishArgs | ||
| dotnet publish "Hangover$Ui/Hangover$Ui.csproj" @publishArgs | ||
| & "C:\Program Files\dotnet\dotnet.exe" publish "Libation$Ui/Libation$Ui.csproj" @publishArgs |
There was a problem hiding this comment.
Mind leaving this out of the PR? Hardcoding C:\Program Files\dotnet\dotnet.exe is machine-specific and unrelated to parallel downloads.
|
Man I saw your reddit post you made right after I submitted this and pretty much gave up on this. I think I've already forgotten what I
Eric Greene
|
Summary
HashSet<Task>loop allowing dynamic concurrency changes mid-run.ScrollToTopmethod onVirtualFlowControl.Auto-scrollandParallel downloads— alongside the existing Cancel All and DL Limit controls.InvalidOperationExceptioncrash insetLiberatedVisibleMenuItemcaused by enumeratingGetVisible()on a background thread while parallel downloads modified the collection. Collection is now snapshotted on the UI thread before being passed toTask.Run.Currentitem with an_activelist to track multiple simultaneous downloads, while keeping the backward-compatibleCurrentproperty.AutoScrollQueue(bool) andMaxConcurrentDownloads(int) persistent settings.Test plan
Parallel downloadscheckbox off mid-run and confirm it serializesAuto-scrolland confirm queue scrolls/stops scrolling to active itemsInvalidOperationExceptioncrash during parallel downloadsCancel Allcancels all active downloads