fix: reliable live task updates in Tasks Manager#98
Merged
Conversation
Task, download and upload tables required a full page reload to show progress because per-model event subscriptions were only wired when the component's static cached list was empty, so newly created models never got subscribed. Static lists were also shared between the Active and Queue table instances, and grid refreshes were fired from background threads without dispatcher marshaling. TransactionInfoService now owns all per-model subscriptions (hooked when a model enters any list, unhooked on remove/clear) and exposes a single aggregated TransactionsChanged event, throttled to 250ms with a guaranteed trailing raise. Tables use instance lists and subscribe only to that event, refreshing via InvokeAsync. The Tasks Manager header stats now update live as well.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When creating an upload/download task and navigating to the Tasks page, tables did not update live — a full page reload was needed for progress events to reach the UI.
Root causes
EventChangedsubscriptions were only (re)wired when the component's cached list was empty (lpt.Count() == 0), so newly created models never got subscribed after the first visit.static, shared between the Active and Queue instances of the same table component (they overwrote each other and cross-unsubscribed onDispose), and persisted across navigations.grid.RefreshDataAsync()from background threads withoutInvokeAsync, fire-and-forget, swallowing any failure.Changes
TransactionInfoServicenow owns all per-model subscriptions: models are hooked when they enter any list (active/pending, uploads/downloads/batch tasks) and unhooked on remove/clear. Any change — list membership or per-model progress/state — is published through a single newTransactionsChangedevent, throttled to 250ms with a guaranteed trailing raise so the final state of a burst is always delivered.TasksTable,UploadsTableandDownloadsTablewere simplified: instance (non-static) lists, a single subscription toTransactionsChanged, refresh marshaled throughInvokeAsyncwith exception handling. No per-model event wiring in the UI anymore.Existing events (
EventChanged,TaskEventChanged, speed history events) are kept intact forMainLayoutandSpeedChart.