Make sure all services are stopped properly

Close #663
pull/663/merge
John Shahid 2014-11-04 15:23:29 -05:00
parent de8836ca4f
commit b5fb4840a9
2 changed files with 9 additions and 4 deletions

View File

@ -12,6 +12,8 @@
- [Issue #1008](https://github.com/influxdb/influxdb/issues/1008). Return
an appropriate exit status code depending on whether the process exits
due to an error or exits gracefully.
- [Issue #663](https://github.com/influxdb/influxdb/issues/663). Make
sure all sub servies are closed when are stopping InfluxDB
- [Issue #584](https://github.com/influxdb/influxdb/issues/584). Don't
panic if the process died while initializing
- [Issue #800](https://github.com/influxdb/influxdb/issues/800). Use

View File

@ -263,10 +263,6 @@ func (self *Server) Stop() {
log.Info("Stopping server")
self.stopped = true
log.Info("Stopping api server")
self.HttpApi.Close()
log.Info("Api server stopped")
if self.Config.GraphiteEnabled {
log.Info("Stopping GraphiteServer")
self.GraphiteApi.Close()
@ -292,4 +288,11 @@ func (self *Server) Stop() {
log.Info("Stopping shard store")
self.shardStore.Close()
log.Info("shard store stopped")
// HttpApi should be the last server to be closed, otherwise
// server.ListenAndServe() will return causing main() to exit before
// the other services are properly stopped
log.Info("Stopping api server")
self.HttpApi.Close()
log.Info("Api server stopped")
}