Skip to content

Commit

Permalink
Use 0 for nil connection.
Browse files Browse the repository at this point in the history
  • Loading branch information
qingyang-hu committed Sep 13, 2023
1 parent eb7d5d3 commit 26368d8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions x/mongo/driver/topology/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,11 @@ func (s *Server) check() (description.Server, error) {
// Create a new connection if this is the first check, the connection was closed after an error during the previous
// check, or the previous check was cancelled.
if s.conn == nil || s.conn.closed() || s.checkWasCancelled() {
connID := "0"
if s.conn != nil {
connID = s.conn.ID()
}
s.publishServerHeartbeatStartedEvent(connID, false)
// Create a new connection and add it's handshake RTT as a sample.
err = s.setupHeartbeatConnection()
duration = time.Since(start)
Expand Down

0 comments on commit 26368d8

Please sign in to comment.