"veyron/runtimes/google/ipc": Bug fix
Check that flowClient.DischargeCache is non-nil before invalidating it.
Change-Id: I07c1b3d59b11d5fc60791119f149f12f95734605
diff --git a/runtimes/google/ipc/client.go b/runtimes/google/ipc/client.go
index 0aa2458..bff3c70 100644
--- a/runtimes/google/ipc/client.go
+++ b/runtimes/google/ipc/client.go
@@ -391,12 +391,12 @@
}
}
if fc.response.Error != nil {
- if verror.Is(fc.response.Error, verror.NotAuthorized) {
+ if verror.Is(fc.response.Error, verror.NotAuthorized) && fc.dischargeCache != nil {
// In case the error was caused by a bad discharge, we do not want to get stuck
// with retrying again and again with this discharge. As there is no direct way
// to detect it, we conservatively flush all discharges we used from the cache.
// TODO(ataly,andreser): add verror.BadDischarge and handle it explicitly?
- vlog.VI(3).Infof("Discarding %d discharges as RPC failed with %v", len(fc.discharges), fc.response.Error)
+ vlog.VI(3).Infof("Discarging %d discharges as RPC failed with %v", len(fc.discharges), fc.response.Error)
fc.dischargeCache.Invalidate(fc.discharges...)
}
return fc.close(verror.ConvertWithDefault(verror.Internal, fc.response.Error))