Harden download stop and restart lifecycle
Publish an explicit lifecycle snapshot with active download and post-processing counts. Guard asynchronous start recovery with a dedicated generation so a stop cannot revive an invalidated run. Keep starts requested during stopping pending until old work drains, then dispatch the accepted request once. Protect active task ownership and post-processing drain cleanup from stale finalizers. Cover recovery invalidation, pending restart dispatch, and late task cleanup with focused regression tests.
This commit is contained in:
@@ -655,6 +655,17 @@ export interface AccountRuntimeEntry {
|
||||
dailyUsageBytes: number;
|
||||
}
|
||||
|
||||
export type DownloadLifecyclePhase = "idle" | "starting" | "running" | "stopping" | "waiting_provider" | "postprocessing";
|
||||
|
||||
export interface DownloadLifecycleSnapshot {
|
||||
phase: DownloadLifecyclePhase;
|
||||
reason: string;
|
||||
retryAt: number | null;
|
||||
activeDownloads: number;
|
||||
activePostProcessing: number;
|
||||
pendingStart: boolean;
|
||||
}
|
||||
|
||||
export interface UiSnapshot {
|
||||
settings: RendererSettings;
|
||||
accounts: RendererAccount[];
|
||||
@@ -685,6 +696,7 @@ export interface UiSnapshot {
|
||||
removedPackageIds?: string[];
|
||||
rotationEvents?: RotationEvent[];
|
||||
accountRuntime?: AccountRuntimeEntry[];
|
||||
lifecycle?: DownloadLifecycleSnapshot;
|
||||
}
|
||||
|
||||
export interface AddLinksPayload {
|
||||
|
||||
Reference in New Issue
Block a user