Files
gitea-MIRROR/cmd
Zhaowei Gu 890effbc91 fix: drain in-flight requests on SIGTERM and close idle connections promptly (#40472)
`gitea web` derived the graceful manager's context from the CLI context,
which is canceled on the first SIGTERM, so in-flight requests were
force-closed and the terminate stage never ran.

- Detach the manager's context from that cancellation. With
`SKIP_MINWINSVC=1` on Windows, Ctrl+C now takes two.
- Close idle HTTP/2 connections at shutdown, which otherwise held every
drain until the hammer.

| SIGTERM with | main | this PR |
|---|---|---|
| no connections | 0.01s, no terminate stage | 1.03s |
| 64 MiB download in flight | cut after 10 MB | completes |
| idle HTTP/2 connection | 0.01s | 1.01s |

Regressed in: https://github.com/go-gitea/gitea/pull/35348
Carries forward https://github.com/go-gitea/gitea/pull/39533 by
@mandel-macaque.

Assisted-by: Hermes Agent:claude-opus-5-5
Assisted-by: Claude Code:claude-opus-5-5

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2026-11-22 10:05:40 +00:00
..