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

Use server GracefulStop instead of force stop #219

Merged
merged 9 commits into from
Jul 2, 2024
Merged
2 changes: 1 addition & 1 deletion gnmi_server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func (srv *Server) Stop() {
log.Errorf("Stop() failed: not initialized")
return
}
s.Stop()
s.GracefulStop()
zbud-msft marked this conversation as resolved.
Show resolved Hide resolved
}

// Address returns the port the Server is listening to.
Expand Down
5 changes: 5 additions & 0 deletions gnmi_server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3503,11 +3503,13 @@ func TestConnectionsKeepAlive(t *testing.T) {
},
}
for _, tt := range(tests) {
var clients []*cacheclient.CacheClient
for i := 0; i < 5; i++ {
t.Run(tt.desc, func(t *testing.T) {
q := tt.q
q.Addrs = []string{"127.0.0.1:8081"}
c := client.New()
clients = append(clients, c)
wg := new(sync.WaitGroup)
wg.Add(1)

Expand All @@ -3529,6 +3531,9 @@ func TestConnectionsKeepAlive(t *testing.T) {
}
})
}
for _, cacheClient := range(clients) {
cacheClient.Close()
}
}
}

Expand Down
Loading