0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-11-21 23:03:39 +01:00

Remove unused error in graceful manager (#29871)

As title.
This commit is contained in:
Nanguan Lin 2024-03-19 05:14:51 +08:00 committed by GitHub
parent 34290a00c4
commit 1f0d31ce8f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 12 deletions

View file

@ -59,8 +59,8 @@ func (g *Manager) start() {
go func() {
defer func() {
close(startupDone)
// Close the unused listeners and ignore the error here there's not much we can do with it, they're logged in the CloseProvidedListeners function
_ = CloseProvidedListeners()
// Close the unused listeners
closeProvidedListeners()
}()
// Wait for all servers to be created
g.createServerCond.L.Lock()

View file

@ -129,25 +129,17 @@ func getProvidedFDs() (savedErr error) {
return savedErr
}
// CloseProvidedListeners closes all unused provided listeners.
func CloseProvidedListeners() error {
// closeProvidedListeners closes all unused provided listeners.
func closeProvidedListeners() {
mutex.Lock()
defer mutex.Unlock()
var returnableError error
for _, l := range providedListeners {
err := l.Close()
if err != nil {
log.Error("Error in closing unused provided listener: %v", err)
if returnableError != nil {
returnableError = fmt.Errorf("%v & %w", returnableError, err)
} else {
returnableError = err
}
}
}
providedListeners = []net.Listener{}
return returnableError
}
// DefaultGetListener obtains a listener for the stream-oriented local network address: