mirror of
https://gitee.com/rainbond/Rainbond.git
synced 2024-11-29 18:27:58 +08:00
fix: 503 service unavailable
This commit is contained in:
parent
ee9c127591
commit
0cd1814feb
@ -21,6 +21,7 @@ package handler
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/goodrain/rainbond/pkg/component/etcd"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@ -82,7 +83,7 @@ func (s *ServiceAction) GetServiceCheckInfo(uuid string) (*exector.ServiceCheckR
|
||||
var si exector.ServiceCheckResult
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
|
||||
defer cancel()
|
||||
resp, err := s.EtcdCli.Get(ctx, k)
|
||||
resp, err := etcd.Default().EtcdClient.Get(ctx, k)
|
||||
if err != nil {
|
||||
logrus.Errorf("get etcd k %s error, %v", k, err)
|
||||
return nil, util.CreateAPIHandleError(503, err)
|
||||
|
@ -27,6 +27,7 @@ import (
|
||||
"github.com/goodrain/rainbond/pkg/component/mq"
|
||||
"github.com/goodrain/rainbond/pkg/component/prom"
|
||||
"net/http"
|
||||
"runtime/debug"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@ -35,6 +36,7 @@ func Recoverer(next http.Handler) http.Handler {
|
||||
fn := func(w http.ResponseWriter, r *http.Request) {
|
||||
defer func() {
|
||||
if rvr := recover(); rvr != nil && rvr != http.ErrAbortHandler {
|
||||
debug.PrintStack()
|
||||
handleServiceUnavailable(w, r)
|
||||
}
|
||||
}()
|
||||
|
Loading…
Reference in New Issue
Block a user