in grpcgcp/gcp_picker.go [129:151]
func (p *gcpPicker) detectUnresponsive(ctx context.Context, scRef *subConnRef, callStarted time.Time, rpcErr error) {
if !p.gb.unresponsiveDetection {
return
}
// Treat as a response from the server if deadline exceeded was not caused by client side context reached deadline.
if dl, ok := ctx.Deadline(); rpcErr == nil || status.Code(rpcErr) != codes.DeadlineExceeded ||
rpcErr.Error() != deErr.Error() || !ok || dl.After(time.Now()) {
scRef.gotResp()
return
}
if callStarted.Before(scRef.lastResp) {
return
}
// Increment deadline exceeded calls and check if there were enough deadline
// exceeded calls and enough time passed since last response to trigger refresh.
if scRef.deCallsInc() >= p.gb.cfg.GetChannelPool().GetUnresponsiveCalls() &&
scRef.lastResp.Before(time.Now().Add(-p.unresponsiveWindow(scRef))) {
p.gb.refresh(scRef)
}
}