Skip to content

Commit

Permalink
fix: null pointer ex when api disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
erayarslan committed Oct 2, 2024
1 parent 255b107 commit 2480aae
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion dcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,10 @@ func (s *dcp) Close() {
s.client.DcpClose()
s.client.Close()

s.api.UnregisterMetricCollectors()
if s.api != nil && !s.config.API.Disabled {
s.api.UnregisterMetricCollectors()
}

s.metricCollectors = []prometheus.Collector{}

logger.Log.Info("dcp stream closed")
Expand Down

0 comments on commit 2480aae

Please sign in to comment.