Skip to content

Commit 6e7a964

Browse files
committed
GODRIVER-3145 Don't retry on context timeout or cancellation.
1 parent b693b75 commit 6e7a964

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

x/mongo/driver/errors.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,10 @@ func (e Error) HasErrorLabel(label string) bool {
294294

295295
// RetryableRead returns true if the error is retryable for a read operation
296296
func (e Error) RetryableRead() bool {
297+
// TODO: Comment? Testing?
298+
if errors.Is(e, context.Canceled) || errors.Is(e, context.DeadlineExceeded) {
299+
return false
300+
}
297301
for _, label := range e.Labels {
298302
if label == NetworkError {
299303
return true

0 commit comments

Comments
 (0)