Merge pull request #6784 from influxdata/js-server-reporting-proper-exit

Perform a proper exit for the reportServer goroutine
pull/6792/head
Jonathan A. Sternberg 2016-06-06 10:03:43 -05:00
commit 7da0638a84
1 changed files with 6 additions and 3 deletions

View File

@ -345,14 +345,17 @@ func (s *Server) Close() error {
// startServerReporting starts periodic server reporting. // startServerReporting starts periodic server reporting.
func (s *Server) startServerReporting() { func (s *Server) startServerReporting() {
s.reportServer()
ticker := time.NewTicker(24 * time.Hour)
defer ticker.Stop()
for { for {
select { select {
case <-s.closing: case <-s.closing:
return return
default: case <-ticker.C:
}
s.reportServer() s.reportServer()
<-time.After(24 * time.Hour) }
} }
} }