Class PluginUpdateCheckService

Namespace
Kuestenlogik.Bowire.Plugins
Assembly
Kuestenlogik.Bowire.dll

Reusable "check installed plugin versions against nuget.org" pipeline shared between the daily background check (PluginUpdateCheckHostedService) and the manual GET /api/plugins/check-updates endpoint.

public class PluginUpdateCheckService : IDisposable
Inheritance
PluginUpdateCheckService
Implements
Inherited Members

Remarks

Hits the NuGet v3-flatcontainer registration index for each installed sibling plugin (bundled plugins are skipped — they move with dotnet tool update, not as standalone packages). Result snapshot is cached on disk under ~/.bowire/state/update-check.json so the UI can render the last-known state without re-hitting nuget.org on every page load.

Constructors

PluginUpdateCheckService()

The service owns its client and the handler under it. It must not take an HttpClient from DI: AddHttpClient registers HttpClient as the factory's default-named client, and a singleton that keeps one keeps the factory's handler entry — which holds the host's root provider, so a disposed host is never collected (#989). A long-lived client instead recycles its connections itself, so a DNS change still reaches the check.

public PluginUpdateCheckService()

Methods

CheckAsync(bool, CancellationToken)

Run a live check against nuget.org for every installed sibling plugin. Result is persisted to Kuestenlogik.Bowire.Plugins.PluginUpdateCheckService.CachePath on success so the next status read returns immediately.

public virtual Task<PluginUpdateCheckSnapshot> CheckAsync(bool includePrerelease, CancellationToken ct)

Parameters

includePrerelease bool
ct CancellationToken

Returns

Task<PluginUpdateCheckSnapshot>

Remarks

Virtual so tests can derive + override to drive the PluginUpdateCheckHostedService's exception-handling path without spinning a fake HTTP stack that throws mid-response.

Dispose()

public void Dispose()

Dispose(bool)

Releases the client; derived test doubles call the base.

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

ReadCached()

Read the last persisted snapshot without hitting the network. Returns null when no check has run yet (cache file absent or unreadable).

public static PluginUpdateCheckSnapshot? ReadCached()

Returns

PluginUpdateCheckSnapshot