1
0
Fork 0
forked from forgejo/forgejo

Graceful: Allow graceful restart for unix sockets (#9113)

Previously we could not handle graceful restarts for http over unix
sockets. These can now be handled.
This commit is contained in:
zeripath 2019-11-24 02:11:24 +00:00 committed by Antoine GIRARD
parent bb2c0c3729
commit e3f22ad2cc
4 changed files with 31 additions and 30 deletions

View file

@ -9,6 +9,7 @@ package graceful
import (
"fmt"
"net"
"os"
"os/exec"
"strings"
@ -48,6 +49,10 @@ func RestartProcess() (int, error) {
if err != nil {
return 0, err
}
if unixListener, ok := l.(*net.UnixListener); ok {
unixListener.SetUnlinkOnClose(false)
}
// Remember to close these at the end.
defer files[i].Close()
}