Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
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
9 changes: 6 additions & 3 deletions web/Classes/Scheduler/HangfireExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,12 @@ public static IServiceCollection AddViperHangfire(
services.AddSingleton<IBackgroundProcess>(_ => new ProcessMonitor(checkInterval: TimeSpan.FromSeconds(30)));

// Inner link of the graceful-shutdown chain: Hangfire 15s <= host
// 30s (Program.cs) <= IIS app pool shutdownTimeLimit 90s (unset,
// so the IIS default applies), so a slot flip drains instead of
// killing work mid-job. Both C# links are pinned at today's
// 30s (Program.cs) <= IIS 90s, so a slot flip drains instead of
// killing work mid-job. IIS has two shutdown paths and both read
// 90s: the ASP.NET Core Module, pinned in web.config because its
// own default is only 10s, and the app pool's
// processModel/shutdownTimeLimit, left unset so the 90s IIS
// default applies. Both C# links are pinned at today's
// framework defaults on purpose: the host default already moved
// once (5s to 30s in .NET 6) and a move either way would invert
// the ordering silently. Note this bounds how long a worker gets
Expand Down
22 changes: 22 additions & 0 deletions web/web.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Source web.config. The SDK's TransformWebConfig task rewrites this at publish
time, filling in processPath, arguments, stdoutLog*, hostingModel and the
aspNetCore handler. Anything set here that the task does not own is carried
through, which is the only way to reach shutdownTimeLimit: there is no
MSBuild property for it.
-->
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<!--
Outer link of the graceful-shutdown chain; HangfireExtensions has the
full chain note. The ASP.NET Core Module's default is 10s, short enough
to cut off Hangfire's 15s drain on any deploy that drops
app_offline.htm. Pinned at 90s to match the app pool's
processModel/shutdownTimeLimit, the other IIS shutdown path.
-->
<aspNetCore shutdownTimeLimit="90" />
</system.webServer>
</location>
</configuration>
Loading