Skip to content

Commit 7941a94

Browse files
committed
refactor: add better error and use custom timeout
1 parent c1518e7 commit 7941a94

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

cmd/kar-controllers/app/generic-server.go

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,6 @@
11
/*
22
Copyright 2017 The Kubernetes Authors.
33
4-
Licensed under the Apache License, Version 2.0 (the "License");
5-
you may not use this file except in compliance with the License.
6-
You may obtain a copy of the License at
7-
8-
http://www.apache.org/licenses/LICENSE-2.0
9-
10-
Unless required by applicable law or agreed to in writing, software
11-
distributed under the License is distributed on an "AS IS" BASIS,
12-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
See the License for the specific language governing permissions and
14-
limitations under the License.
15-
*/
16-
/*
17-
Copyright 2019, 2021 The Multi-Cluster App Dispatcher Authors.
18-
194
Licensed under the Apache License, Version 2.0 (the "License");
205
you may not use this file except in compliance with the License.
216
You may obtain a copy of the License at
@@ -109,9 +94,9 @@ func (s *Server) Shutdown() error {
10994
return nil
11095
}
11196

112-
logger.Info("Stopping server")
97+
logger.Infof("Shutting down endpoint %s at %s (gracefully waiting for %s)", s.endpoint, s.listener.Addr(), s.shutdownTimeout)
11398

114-
shutdownCtx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
99+
shutdownCtx, cancel := context.WithTimeout(context.Background(), s.shutdownTimeout)
115100
defer cancel()
116101

117102
// Try graceful shutdown

0 commit comments

Comments
 (0)