mirror of
https://github.com/caddyserver/caddy.git
synced 2025-01-22 08:36:27 +01:00
core: Only initiate exit once (should fix #6707)
This commit is contained in:
parent
3f3f8b3d52
commit
34cff4af7d
1 changed files with 4 additions and 2 deletions
6
caddy.go
6
caddy.go
|
@ -725,8 +725,10 @@ func Validate(cfg *Config) error {
|
||||||
// Errors are logged along the way, and an appropriate exit
|
// Errors are logged along the way, and an appropriate exit
|
||||||
// code is emitted.
|
// code is emitted.
|
||||||
func exitProcess(ctx context.Context, logger *zap.Logger) {
|
func exitProcess(ctx context.Context, logger *zap.Logger) {
|
||||||
// let the rest of the program know we're quitting
|
// let the rest of the program know we're quitting; only do it once
|
||||||
atomic.StoreInt32(exiting, 1)
|
if !atomic.CompareAndSwapInt32(exiting, 0, 1) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// give the OS or service/process manager our 2 weeks' notice: we quit
|
// give the OS or service/process manager our 2 weeks' notice: we quit
|
||||||
if err := notify.Stopping(); err != nil {
|
if err := notify.Stopping(); err != nil {
|
||||||
|
|
Loading…
Reference in a new issue