Skip to content

Commit 0cd1814

Browse files
committed
fix: 503 service unavailable
1 parent ee9c127 commit 0cd1814

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

api/handler/service_check.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ package handler
2121
import (
2222
"context"
2323
"fmt"
24+
"github.com/goodrain/rainbond/pkg/component/etcd"
2425
"strings"
2526
"time"
2627

@@ -82,7 +83,7 @@ func (s *ServiceAction) GetServiceCheckInfo(uuid string) (*exector.ServiceCheckR
8283
var si exector.ServiceCheckResult
8384
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
8485
defer cancel()
85-
resp, err := s.EtcdCli.Get(ctx, k)
86+
resp, err := etcd.Default().EtcdClient.Get(ctx, k)
8687
if err != nil {
8788
logrus.Errorf("get etcd k %s error, %v", k, err)
8889
return nil, util.CreateAPIHandleError(503, err)

pkg/interceptors/http.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
"github.com/goodrain/rainbond/pkg/component/mq"
2828
"github.com/goodrain/rainbond/pkg/component/prom"
2929
"net/http"
30+
"runtime/debug"
3031
"strings"
3132
)
3233

@@ -35,6 +36,7 @@ func Recoverer(next http.Handler) http.Handler {
3536
fn := func(w http.ResponseWriter, r *http.Request) {
3637
defer func() {
3738
if rvr := recover(); rvr != nil && rvr != http.ErrAbortHandler {
39+
debug.PrintStack()
3840
handleServiceUnavailable(w, r)
3941
}
4042
}()

0 commit comments

Comments
 (0)