Skip to content

F-043 (P6) β€” Eager startup discovery with CancellationToken.None, redundant to the hosted servicesΒ #86

Description

@LarsLaskowski

Severity: 🟑 Β· Criterion: K4 / K5 Β· Phase: P6 Β· Status (review): πŸ†•

File(s): src/DockerUpdateGuard/ApplicationInitializationExtensions.cs:39-44; cross-reference hosted services src/DockerUpdateGuard/ServiceCollectionExtensions.cs:129-135

Finding

After the migration, the initialization synchronously runs
SynchronizeConfiguredInstancesAsync, SynchronizeAccountImagesAsync and
RefreshInventoryMetricsAsync β€” each with CancellationToken.None. The same
discovery work is done anyway by the registered hosted services
(DockerInstanceDiscoveryBackgroundService, DockerHubAccountImageDiscoveryBackgroundService)
periodically; the eager call is thus largely redundant. CancellationToken.None means:
even a SIGTERM during a slow startup sync (Docker Hub network) does not abort the operation
β€” readiness is delayed until all three steps (bounded by the HttpClient timeout)
complete. On the positive side: the network errors themselves are degraded rather than thrown
(SynchronizeAccountImagesAsync checks ExternalOperationResult.Status, :188-194;
SynchronizeConfiguredInstancesAsync is pure config/DB work) β€” so an unreachable
Docker Hub/instance does not crash the startup.

Impact

Delayed/blocked readiness at boot, not abortable on shutdown;
duplicate initial execution of the discovery. No correctness/security consequence.

Recommendation

Pass the app-lifetime token (IHostApplicationLifetime.ApplicationStopping) instead of
CancellationToken.None; leave the initial discovery to the hosted services
(e.g. "RunOnStartup" in ScheduledBackgroundService) or time-box it, so that startup
does not hang on external services.


Auto-generated from the repository code review. Source of truth: docs/review/findings.md β†’ F-043 (P6), branch review/review-analysis-plan.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions