Skip to content

Commit adb9a4f

Browse files
committed
[sse] fix active connections metric
1 parent fe76ed5 commit adb9a4f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

internal/sms-gateway/modules/sse/service.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,9 @@ func (s *Service) removeConnection(deviceID, connID string) {
226226
if conn.id == connID {
227227
close(conn.closeSignal)
228228
s.connections[deviceID] = append(connections[:i], connections[i+1:]...)
229+
230+
// Decrement active connections metric
231+
s.metrics.DecrementActiveConnections()
229232
s.logger.Info(
230233
"Removing SSE connection",
231234
zap.String("device_id", deviceID),
@@ -235,9 +238,6 @@ func (s *Service) removeConnection(deviceID, connID string) {
235238
}
236239
}
237240

238-
// Decrement active connections metric
239-
s.metrics.DecrementActiveConnections()
240-
241241
if len(s.connections[deviceID]) == 0 {
242242
delete(s.connections, deviceID)
243243
}

0 commit comments

Comments
 (0)