forked from forgejo/forgejo
Add Graceful shutdown for Windows and hooks for shutdown of goroutines (#8964)
* Graceful Shutdown for windows and others Restructures modules/graceful, adding shutdown for windows, removing and replacing the old minwinsvc code. Creates a new waitGroup - terminate which allows for goroutines to finish up after the shutdown of the servers. Shutdown and terminate hooks are added for goroutines. * Remove unused functions - these can be added in a different PR * Add startup timeout functionality * Document STARTUP_TIMEOUT
This commit is contained in:
parent
d7ac9727bb
commit
cbaa1de9ec
30 changed files with 666 additions and 497 deletions
|
@ -24,7 +24,6 @@ import (
|
|||
"code.gitea.io/gitea/modules/generate"
|
||||
"code.gitea.io/gitea/modules/git"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
_ "code.gitea.io/gitea/modules/minwinsvc" // import minwinsvc for windows services
|
||||
"code.gitea.io/gitea/modules/user"
|
||||
|
||||
shellquote "github.com/kballard/go-shellquote"
|
||||
|
@ -99,6 +98,7 @@ var (
|
|||
LetsEncryptEmail string
|
||||
GracefulRestartable bool
|
||||
GracefulHammerTime time.Duration
|
||||
StartupTimeout time.Duration
|
||||
StaticURLPrefix string
|
||||
|
||||
SSH = struct {
|
||||
|
@ -569,6 +569,7 @@ func NewContext() {
|
|||
HTTPPort = sec.Key("HTTP_PORT").MustString("3000")
|
||||
GracefulRestartable = sec.Key("ALLOW_GRACEFUL_RESTARTS").MustBool(true)
|
||||
GracefulHammerTime = sec.Key("GRACEFUL_HAMMER_TIME").MustDuration(60 * time.Second)
|
||||
StartupTimeout = sec.Key("STARTUP_TIMEOUT").MustDuration(0 * time.Second)
|
||||
|
||||
defaultAppURL := string(Protocol) + "://" + Domain
|
||||
if (Protocol == HTTP && HTTPPort != "80") || (Protocol == HTTPS && HTTPPort != "443") {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue