From a321901ad89281b6edbbbc069b79231e0790fcbe Mon Sep 17 00:00:00 2001 From: Mahmood Ali Date: Thu, 25 Apr 2019 18:39:17 -0400 Subject: [PATCH] retry grpc unavailable errors even if not shutting down --- client/allocrunner/taskrunner/logmon_hook.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/allocrunner/taskrunner/logmon_hook.go b/client/allocrunner/taskrunner/logmon_hook.go index 9efc62218..77770d6b5 100644 --- a/client/allocrunner/taskrunner/logmon_hook.go +++ b/client/allocrunner/taskrunner/logmon_hook.go @@ -16,6 +16,8 @@ import ( "github.com/hashicorp/nomad/nomad/structs" bstructs "github.com/hashicorp/nomad/plugins/base/structs" pstructs "github.com/hashicorp/nomad/plugins/shared/structs" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" ) const ( @@ -100,7 +102,7 @@ func (h *logmonHook) Prestart(ctx context.Context, attempts := 0 for { err := h.prestartOneLoop(ctx, req) - if err == bstructs.ErrPluginShutdown { + if err == bstructs.ErrPluginShutdown || grpc.Code(err) == codes.Unavailable { h.logger.Warn("logmon shutdown while making request", "error", err) if attempts > 3 {