Skip to content

Commit

Permalink
fix panic on close
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanielc committed Mar 8, 2017
1 parent bb576c2 commit 0375e6d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
4 changes: 3 additions & 1 deletion services/alert/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ func (s *apiServer) Open() error {
}

func (s *apiServer) Close() error {
s.HTTPDService.DelRoutes(s.routes)
if s.HTTPDService != nil {
s.HTTPDService.DelRoutes(s.routes)
}
return nil
}

Expand Down
14 changes: 7 additions & 7 deletions services/alert/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,13 @@ func (s *Service) Open() error {
return nil
}

func (s *Service) Close() error {
s.mu.Lock()
defer s.mu.Unlock()
s.topics.Close()
return s.APIServer.Close()
}

func (s *Service) loadSavedHandlerSpecs() error {
offset := 0
limit := 100
Expand Down Expand Up @@ -235,13 +242,6 @@ func (s *Service) loadSavedTopicStates() error {
return nil
}

func (s *Service) Close() error {
s.mu.Lock()
defer s.mu.Unlock()
s.topics.Close()
return s.APIServer.Close()
}

func validatePattern(pattern string) error {
_, err := path.Match(pattern, "")
return err
Expand Down

0 comments on commit 0375e6d

Please sign in to comment.