Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Diagnostics;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Umbraco.Cms.Core;
Expand All @@ -22,10 +21,6 @@ public class DistributedBackgroundJobHostedService : BackgroundService
/// <summary>
/// Initializes a new instance of the <see cref="DistributedBackgroundJobHostedService"/> class.
/// </summary>
/// <param name="logger"></param>
/// <param name="runtimeState"></param>
/// <param name="distributedJobService"></param>
/// <param name="distributedJobSettings"></param>
public DistributedBackgroundJobHostedService(
ILogger<DistributedBackgroundJobHostedService> logger,
IRuntimeState runtimeState,
Expand Down Expand Up @@ -68,6 +63,13 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
_logger.LogInformation("Timed Hosted Service is stopping.");
}
catch (Exception)
{
// Ensure that the app doesn't shut down gracefully so that environments like Kubernetes can restart it
// See https://github.com/dotnet/runtime/issues/67146 for more information.
Environment.ExitCode = 1;
throw;
}
}

private async Task RunRunnableJob()
Expand Down
Loading