@@ -554,23 +554,30 @@ func (s *Server) update() {
554
554
defer s .processErrorLock .Unlock ()
555
555
556
556
s .updateDescription (desc )
557
- if lastError := desc .LastError ; lastError != nil {
558
- // Retry after the first timeout in case of a FAAS pause as described in GODRIVER-2577.
559
- if err := unwrapConnectionError (lastError ); err != nil {
560
- err , ok := err .(net.Error )
561
- if ok && err .Timeout () && timeoutCnt < 1 {
562
- timeoutCnt ++
563
- // Continue to next loop.
564
- return true
565
- }
557
+ // Retry after the first timeout before clearing the pool in case of a FAAS pause as
558
+ // described in GODRIVER-2577.
559
+ if err := unwrapConnectionError (desc .LastError ); err != nil && timeoutCnt < 1 {
560
+ if err == context .Canceled || err == context .DeadlineExceeded {
561
+ timeoutCnt ++
562
+ // We want to immediately retry on timeout error. Continue to next loop.
563
+ return true
566
564
}
565
+ if err , ok := err .(net.Error ); ok && err .Timeout () {
566
+ timeoutCnt ++
567
+ // We want to immediately retry on timeout error. Continue to next loop.
568
+ return true
569
+ }
570
+ }
571
+ if err := desc .LastError ; err != nil {
567
572
// Clear the pool once the description has been updated to Unknown. Pass in a nil service ID to clear
568
573
// because the monitoring routine only runs for non-load balanced deployments in which servers don't return
569
574
// IDs.
570
575
s .pool .clear (err , nil )
571
576
}
577
+ // We're either not handling a timeout error, or we just handled the 2nd consecutive
578
+ // timeout error. In either case, reset the timeout count to 0 and return false to
579
+ // continue the normal check process.
572
580
timeoutCnt = 0
573
- // Run forward.
574
581
return false
575
582
}(); isShortcut {
576
583
continue
0 commit comments