mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-11-13 15:29:12 +01:00
wdclient: reuse isCanceledErr for the elapsed-deadline check
This commit is contained in:
1 parent
138f356c5d
commit
e79138f597
1 file changed
+2
-3
@@ -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
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user