mirror of
https://github.com/pgsty/minio.git
synced 2026-07-20 12:40:24 +03:00
Add a generic registerShutdown function for graceful exit (#2344)
* Add a generic registerShutdown function for graceful exit * Add shutdown callback test case
This commit is contained in:
committed by
Harshavardhana
parent
62c0612eac
commit
d28fb5fe23
@@ -275,6 +275,11 @@ func serverMain(c *cli.Context) {
|
||||
// Prints the formatted startup message.
|
||||
printStartupMessage(endPoints)
|
||||
|
||||
registerShutdown(func() errCode {
|
||||
// apiServer.Stop()
|
||||
return exitSuccess
|
||||
})
|
||||
|
||||
// Start server.
|
||||
// Configure TLS if certs are available.
|
||||
if tls {
|
||||
@@ -283,5 +288,6 @@ func serverMain(c *cli.Context) {
|
||||
// Fallback to http.
|
||||
err = apiServer.ListenAndServe()
|
||||
}
|
||||
|
||||
fatalIf(err, "Failed to start minio server.")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user