diff --git a/AppInsightsWithWebJob/ContinuousJob.cs b/AppInsightsWithWebJob/ContinuousJob.cs index 9194d55..e1c9543 100644 --- a/AppInsightsWithWebJob/ContinuousJob.cs +++ b/AppInsightsWithWebJob/ContinuousJob.cs @@ -30,12 +30,16 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken) { logger.LogCritical("[JOB] Continuous job threw an exceptions. {0}", exception); telemetryClient.TrackException(exception); - - await Task.Delay(5_000); // delay to allow telemetry to be written out. - Environment.FailFast("Shutting down webjob due to a critical error."); } } + public override Task StopAsync(CancellationToken cancellationToken) + { + logger.LogDebug("StopAsync called"); + + return base.StopAsync(cancellationToken); + } + private async Task Process(CancellationToken stoppingToken) { var counter = 0;