Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-1647

averageRTTSet is never set

    • Fully Compatible

      There's code in updateAverageRTT that computes a trailing RTT average.  However, that code is gated on averageRTTSet, and that's never set to true.

      func (s *Server) updateAverageRTT(delay time.Duration) time.Duration {
          if !s.averageRTTSet {
              s.averageRTT = delay
          } else {
              alpha := 0.2
              s.averageRTT = time.Duration(alpha*float64(delay) + (1-alpha)*float64(s.averageRTT))
          }
          return s.averageRTT
      } 

      That should probably be:

      func (s *Server) updateAverageRTT(delay time.Duration) time.Duration {
          if !s.averageRTTSet {
              s.averageRTT = delay
              s.averageRTTSet = true
          } else {
              alpha := 0.2
              s.averageRTT = time.Duration(alpha*float64(delay) + (1-alpha)*float64(s.averageRTT))
          }
          return s.averageRTT
      } 

            Assignee:
            kriti.ravindran@mongodb.com Kriti Ravindran (Inactive)
            Reporter:
            bartle David Bartley
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: