wdclient: treat an elapsed caller deadline as caller-gave-up on lookup errors

gRPC can surface its own DeadlineExceeded a tick before ctx.Err() becomes
visible, so a lookup that died on the caller's deadline was sporadically
recorded as a filer failure (seen in the linux/386 job).
This commit is contained in:
chrislusf committed 2026-10-28 00:24:16 -07:00
1 parent 3b65169d6c
commit a70f001e26
1 file changed
+10 -2
+10 -2
View File
@@ -788,8 +788,16 @@ func (p *filerVolumeProvider) LookupVolumeIds(ctx context.Context, volumeIds []s
}()
if err != nil {
// a caller that gave up says nothing about this filer
if ctxErr := ctx.Err(); ctxErr != nil {
// a caller that gave up says nothing about this filer; check the
// deadline too since gRPC can report its own DeadlineExceeded a
// tick before ctx.Err() becomes visible
ctxErr := ctx.Err()
if ctxErr == nil {
if dl, ok := ctx.Deadline(); ok && !dl.After(time.Now()) {
ctxErr = context.DeadlineExceeded
}
}
if ctxErr != nil {
if lastErr != nil {
return nil, fmt.Errorf("%w (earlier filer error: %v)", ctxErr, lastErr)
}