Class UpdateService
Hosted service that periodically checks for daemon updates and orchestrates graceful update application.
public sealed class UpdateService : BackgroundService, IHostedService, IDisposable
- Inheritance
-
UpdateService
- Implements
- Inherited Members
Constructors
UpdateService(IOptions<UpdateConfig>, UpdateChecker, IEventBus, IHostApplicationLifetime, ILogger<UpdateService>)
public UpdateService(IOptions<UpdateConfig> config, UpdateChecker checker, IEventBus events, IHostApplicationLifetime lifetime, ILogger<UpdateService> logger)
Parameters
configIOptions<UpdateConfig>checkerUpdateCheckereventsIEventBuslifetimeIHostApplicationLifetimeloggerILogger<UpdateService>
Properties
IsDraining
Whether the service is currently draining for an update.
public bool IsDraining { get; }
Property Value
PendingUpdate
The last detected pending update, if any.
public UpdateInfo? PendingUpdate { get; }
Property Value
Methods
ApplyUpdateAsync(CancellationToken)
Applies a pending update: drains agents, runs dotnet tool update, restarts the service. Can be called manually by the CLI update command.
public Task ApplyUpdateAsync(CancellationToken ct = default)
Parameters
Returns
CheckAllToolsAsync(CancellationToken)
Checks all installed JD.AI tools for updates and returns a structured plan.
public Task<AllToolsUpdatePlan> CheckAllToolsAsync(CancellationToken ct = default)
Parameters
Returns
ExecuteAsync(CancellationToken)
This method is called when the IHostedService starts. The implementation should return a task that represents the lifetime of the long running operation(s) being performed.
protected override Task ExecuteAsync(CancellationToken stoppingToken)
Parameters
stoppingTokenCancellationTokenTriggered when StopAsync(CancellationToken) is called.
Returns
Remarks
See Worker Services in .NET for implementation guidelines.
UpdateAllToolsAsync(CancellationToken)
Applies updates to all installed JD.AI tools: drains agents, updates each tool, then restarts the daemon. Can be called manually via the CLI update command.
public Task UpdateAllToolsAsync(CancellationToken ct = default)