mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-07-08 01:00:03 +02:00
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
19
modules/graceful/net_windows.go
Normal file
19
modules/graceful/net_windows.go
Normal file
|
@ -0,0 +1,19 @@
|
|||
// +build windows
|
||||
|
||||
// Copyright 2019 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
// This code is heavily inspired by the archived gofacebook/gracenet/net.go handler
|
||||
|
||||
package graceful
|
||||
|
||||
import "net"
|
||||
|
||||
// GetListener obtains a listener for the local network address.
|
||||
// On windows this is basically just a shim around net.Listen.
|
||||
func GetListener(network, address string) (net.Listener, error) {
|
||||
// Add a deferral to say that we've tried to grab a listener
|
||||
defer Manager.InformCleanup()
|
||||
|
||||
return net.Listen(network, address)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue