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

feat(net/ghttp): move plugin remove logic to Shutdown() && call Shutdown() when Run() exits #4072

Merged
merged 5 commits into from
Dec 26, 2024
Merged
Changes from 1 commit
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
16 changes: 8 additions & 8 deletions net/ghttp/ghttp_server_admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,6 @@ func (s *Server) EnableAdmin(pattern ...string) {
// Shutdown shuts the current server.
func (s *Server) Shutdown() error {
var ctx = context.TODO()
s.doServiceDeregister()
// Only shut down current servers.
// It may have multiple underlying http servers.
for _, v := range s.servers {
v.Shutdown(ctx)
}
s.Logger().Infof(ctx, "pid[%d]: all servers shutdown", gproc.Pid())

// Remove plugins.
if len(s.plugins) > 0 {
for _, p := range s.plugins {
Expand All @@ -108,5 +100,13 @@ func (s *Server) Shutdown() error {
}
}
}

s.doServiceDeregister()
gqcn marked this conversation as resolved.
Show resolved Hide resolved
// Only shut down current servers.
// It may have multiple underlying http servers.
for _, v := range s.servers {
v.Shutdown(ctx)
}
s.Logger().Infof(ctx, "pid[%d]: all servers shutdown", gproc.Pid())
return nil
}
Loading