Skip to content

Commit

Permalink
Override StopAsync
Browse files Browse the repository at this point in the history
  • Loading branch information
SeanFeldman committed Apr 24, 2019
1 parent e9cf8af commit de44ff3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions AppInsightsWithWebJob/ContinuousJob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit de44ff3

Please sign in to comment.