public Task StartAsync(CancellationToken cancellationToken) { if (!_env.IsDeployedInKubernetes()) { return(Task.CompletedTask); } _applicationLifetime.ApplicationStopped.Register(() => { _logger.LogInformation("SIGTERM received, waiting for ingress to switch configuration"); Task.Run(async() => await Task.Delay(30_000)).GetAwaiter().GetResult(); _logger.LogInformation("TERMINATING"); }); return(Task.CompletedTask); }