mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-04-28 15:59:48 +00:00
Added documentation
This commit is contained in:
parent
9e965b32df
commit
feb7e9e6ed
@ -30,9 +30,15 @@ public sealed class UpdateService : BackgroundService, IMessageBusReceiver
|
|||||||
|
|
||||||
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// Wait until the app is fully initialized.
|
||||||
|
//
|
||||||
while (!stoppingToken.IsCancellationRequested && !IS_INITIALIZED)
|
while (!stoppingToken.IsCancellationRequested && !IS_INITIALIZED)
|
||||||
await Task.Delay(TimeSpan.FromSeconds(3), stoppingToken);
|
await Task.Delay(TimeSpan.FromSeconds(3), stoppingToken);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Set the update interval based on the user's settings.
|
||||||
|
//
|
||||||
this.updateInterval = this.settingsManager.ConfigurationData.App.UpdateBehavior switch
|
this.updateInterval = this.settingsManager.ConfigurationData.App.UpdateBehavior switch
|
||||||
{
|
{
|
||||||
UpdateBehavior.NO_CHECK => Timeout.InfiniteTimeSpan,
|
UpdateBehavior.NO_CHECK => Timeout.InfiniteTimeSpan,
|
||||||
@ -45,10 +51,23 @@ public sealed class UpdateService : BackgroundService, IMessageBusReceiver
|
|||||||
_ => TimeSpan.FromHours(1)
|
_ => TimeSpan.FromHours(1)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
// When the user doesn't want to check for updates, we can
|
||||||
|
// return early.
|
||||||
|
//
|
||||||
if(this.settingsManager.ConfigurationData.App.UpdateBehavior is UpdateBehavior.NO_CHECK)
|
if(this.settingsManager.ConfigurationData.App.UpdateBehavior is UpdateBehavior.NO_CHECK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check for updates at the beginning. The user aspects this when the app
|
||||||
|
// is started.
|
||||||
|
//
|
||||||
await this.CheckForUpdate();
|
await this.CheckForUpdate();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Start the update loop. This will check for updates based on the
|
||||||
|
// user's settings.
|
||||||
|
//
|
||||||
while (!stoppingToken.IsCancellationRequested)
|
while (!stoppingToken.IsCancellationRequested)
|
||||||
{
|
{
|
||||||
await Task.Delay(this.updateInterval, stoppingToken);
|
await Task.Delay(this.updateInterval, stoppingToken);
|
||||||
|
Loading…
Reference in New Issue
Block a user