wdclient: reuse isCanceledErr for the elapsed-deadline check

This commit is contained in:
chrislusf committed 2026-10-28 00:43:15 -07:00
1 parent 138f356c5d
commit e79138f597
1 file changed
+2 -3
+2 -3
View File
@@ -2,7 +2,6 @@ package wdclient
import (
"context"
"errors"
"fmt"
"math/rand"
"strings"
@@ -791,9 +790,9 @@ func (p *filerVolumeProvider) LookupVolumeIds(ctx context.Context, volumeIds []s
if err != nil {
// a caller that gave up says nothing about this filer; gRPC can
// surface its own DeadlineExceeded a tick before ctx.Err()
// becomes visible, so reinterpret only deadline errors this way
// becomes visible, so reinterpret only cancellation errors this way
ctxErr := ctx.Err()
if ctxErr == nil && (errors.Is(err, context.DeadlineExceeded) || status.Code(err) == codes.DeadlineExceeded) {
if ctxErr == nil && isCanceledErr(err) {
if dl, ok := ctx.Deadline(); ok && !dl.After(time.Now()) {
ctxErr = context.DeadlineExceeded
}