Skip to content

Commit

Permalink
Merge pull request #6 from karolz-ms/dev/karolz/kubernetes
Browse files Browse the repository at this point in the history
Default shutdown timeout IS 30 seconds
  • Loading branch information
richlander committed Apr 13, 2023
2 parents d1a4fcf + 42fe9a9 commit 3a6664e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion samples/kubernetes/graceful-shutdown/graceful-shutdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Kubernetes-hosted applications should shut down smoothly and quickly when asked

Kubernetes will send `SIGTERM` signal to the main container process as means of requesting shutdown. By default the container has 30 seconds to exit gracefully before it gets killed, but this can be changed via [container lifecycle spec](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#lifecycle).

The default ASP.NET host [handles SIGTERM signal](https://learn.microsoft.com/aspnet/core/fundamentals/host/generic-host#ihostlifetime) and will raise the `ApplicationStopping` event when that happens. The host will stop accepting new requests, but the requests already "in flight" will run to completion, subject to a timeout. The default shutdown timeout in ASP.NET is 5 seconds, and can be changed via `HostOptions.ShutdownTimeout`, for example:
The default ASP.NET host [handles SIGTERM signal](https://learn.microsoft.com/aspnet/core/fundamentals/host/generic-host#ihostlifetime) and will raise the `ApplicationStopping` event when that happens. The host will stop accepting new requests, but the requests already "in flight" will run to completion, subject to a timeout. The default shutdown timeout in ASP.NET is 30 seconds, and can be changed via `HostOptions.ShutdownTimeout`, for example:

```csharp
builder.Host.ConfigureHostOptions(opts => opts.ShutdownTimeout = TimeSpan.FromSeconds(20));
Expand Down

0 comments on commit 3a6664e

Please sign in to comment.