mirror of
https://gitee.com/rainbond/Rainbond.git
synced 2024-12-02 03:37:46 +08:00
fix probe disable invalid bug
This commit is contained in:
parent
da2476fbc4
commit
fa831cabf0
@ -41,7 +41,7 @@ import (
|
||||
"github.com/jinzhu/gorm"
|
||||
"github.com/pquerna/ffjson/ffjson"
|
||||
"github.com/renstorm/fuzzysearch/fuzzy"
|
||||
"github.com/thedevsaddam/govalidator"
|
||||
validator "github.com/thedevsaddam/govalidator"
|
||||
)
|
||||
|
||||
//V2Routes v2Routes
|
||||
@ -601,15 +601,12 @@ func (t *TenantStruct) CreateService(w http.ResponseWriter, r *http.Request) {
|
||||
// schema:
|
||||
// "$ref": "#/responses/commandResponse"
|
||||
// description: 统一返回格式
|
||||
logrus.Debugf("trans create service service")
|
||||
var ss api_model.ServiceStruct
|
||||
body, err := ioutil.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
httputil.ReturnError(r, w, 500, err.Error())
|
||||
return
|
||||
}
|
||||
logrus.Debugf("request uri: %s; body: %s", r.RequestURI, string(body))
|
||||
|
||||
err = ffjson.Unmarshal(body, &ss)
|
||||
if err != nil {
|
||||
httputil.ReturnError(r, w, 500, err.Error())
|
||||
@ -1605,7 +1602,7 @@ func (t *TenantStruct) AddProbe(w http.ResponseWriter, r *http.Request) {
|
||||
tspD.FailureThreshold = tsp.FailureThreshold
|
||||
tspD.HTTPHeader = tsp.HTTPHeader
|
||||
tspD.InitialDelaySecond = tsp.InitialDelaySecond
|
||||
tspD.IsUsed = tsp.IsUsed
|
||||
tspD.IsUsed = &tsp.IsUsed
|
||||
tspD.Mode = tsp.Mode
|
||||
tspD.Path = tsp.Path
|
||||
tspD.PeriodSecond = tsp.PeriodSecond
|
||||
@ -1655,7 +1652,7 @@ func (t *TenantStruct) UpdateProbe(w http.ResponseWriter, r *http.Request) {
|
||||
tspD.FailureThreshold = tsp.FailureThreshold
|
||||
tspD.HTTPHeader = tsp.HTTPHeader
|
||||
tspD.InitialDelaySecond = tsp.InitialDelaySecond
|
||||
tspD.IsUsed = tsp.IsUsed
|
||||
tspD.IsUsed = &tsp.IsUsed
|
||||
tspD.Mode = tsp.Mode
|
||||
tspD.Path = tsp.Path
|
||||
tspD.PeriodSecond = tsp.PeriodSecond
|
||||
|
@ -409,7 +409,7 @@ type TenantServiceProbe struct {
|
||||
//检测超时时间
|
||||
TimeoutSecond int `gorm:"column:timeout_second;size:3;default:30" json:"timeout_second" validate:"timeout_second"`
|
||||
//是否启用
|
||||
IsUsed int `gorm:"column:is_used;size:1;default:1" json:"is_used" validate:"is_used"`
|
||||
IsUsed *int `gorm:"column:is_used;size:1;default:1" json:"is_used" validate:"is_used"`
|
||||
//标志为失败的检测次数
|
||||
FailureThreshold int `gorm:"column:failure_threshold;size:2;default:3" json:"failure_threshold" validate:"failure_threshold"`
|
||||
//标志为成功的检测次数
|
||||
|
@ -29,7 +29,7 @@ import (
|
||||
"github.com/goodrain/rainbond/db"
|
||||
"github.com/goodrain/rainbond/db/model"
|
||||
uitlprober "github.com/goodrain/rainbond/util/prober"
|
||||
"github.com/goodrain/rainbond/util/prober/types/v1"
|
||||
v1 "github.com/goodrain/rainbond/util/prober/types/v1"
|
||||
"github.com/goodrain/rainbond/worker/appm/store"
|
||||
"github.com/goodrain/rainbond/worker/appm/thirdparty/discovery"
|
||||
appmv1 "github.com/goodrain/rainbond/worker/appm/types/v1"
|
||||
@ -216,7 +216,7 @@ func (t *tpProbe) StopProbe(ep *corev1.Endpoints) {
|
||||
// If there is no probe in the database, return a default probe
|
||||
func (t *tpProbe) GetProbeInfo(sid string) (*model.TenantServiceProbe, error) {
|
||||
probes, err := t.dbm.ServiceProbeDao().GetServiceProbes(sid)
|
||||
if err != nil || probes == nil || len(probes) == 0 || probes[0].IsUsed == 0 {
|
||||
if err != nil || probes == nil || len(probes) == 0 || *(probes[0].IsUsed) == 0 {
|
||||
if err != nil {
|
||||
logrus.Warningf("ServiceID: %s; error getting probes: %v", sid, err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user