Merge pull request #394 from liubin/393/handle-rpc-call-not-implemented

runtime: handle unimplemented RPC call by NotFound status code
This commit is contained in:
Hui Zhu
2020-07-08 14:24:20 +08:00
committed by GitHub
2 changed files with 3 additions and 1 deletions

View File

@@ -35,5 +35,6 @@ func TestIsGRPCErrorCode(t *testing.T) {
assert := assert.New(t)
assert.True(isGRPCErrorCode(codes.Unimplemented, status.New(codes.Unimplemented, "foobar").Err()))
assert.True(isGRPCErrorCode(codes.NotFound, status.New(codes.NotFound, "foobar").Err()))
assert.False(isGRPCErrorCode(codes.Unimplemented, errors.New("foobar")))
}

View File

@@ -145,7 +145,8 @@ func watchOOMEvents(ctx context.Context, s *service) {
logrus.WithField("sandbox", s.sandbox.ID()).WithError(err).Warn("failed to get OOM event from sandbox")
// If the GetOOMEvent call is not implemented, then the agent is most likely an older version,
// stop attempting to get OOM events.
if isGRPCErrorCode(codes.Unimplemented, err) {
// for rust agent, the response code is not found
if isGRPCErrorCode(codes.NotFound, err) {
return
}
continue