Ignore "no such process" error (#1686)

* Cleanup how status is updated for service. Ignore "no such process" error as it could be that the pid died

* add nice error log to record process error exit
This commit is contained in:
Dominic Wong
2020-06-08 10:47:25 +01:00
parent d613804b0a
commit 86dfcb819b
4 changed files with 35 additions and 26 deletions

View File

@@ -3,6 +3,7 @@ package kubernetes
import (
"encoding/json"
"strings"
"time"
"github.com/micro/go-micro/v2/logger"
"github.com/micro/go-micro/v2/runtime"
@@ -185,8 +186,10 @@ func (s *service) Update(k client.Client, opts ...client.UpdateOption) error {
}
func (s *service) Status(status string, err error) {
s.Metadata["lastStatusUpdate"] = time.Now().Format(time.RFC3339)
if err == nil {
s.Metadata["status"] = status
delete(s.Metadata, "error")
return
}
s.Metadata["status"] = "error"