Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused error in graceful manager #29871

Merged
merged 3 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions modules/graceful/manager_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
12 changes: 2 additions & 10 deletions modules/graceful/net_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down