mirror of
https://github.com/yusing/godoxy.git
synced 2025-06-09 04:52:35 +02:00
fixed zero timeout causing health check to fail
This commit is contained in:
parent
51f9afb471
commit
a4f44348ef
2 changed files with 8 additions and 10 deletions
|
@ -130,11 +130,18 @@ func (e *RawEntry) Finalize() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if e.HealthCheck == nil {
|
if e.HealthCheck == nil {
|
||||||
e.HealthCheck = health.DefaultHealthCheckConfig()
|
e.HealthCheck = new(health.HealthCheckConfig)
|
||||||
}
|
}
|
||||||
|
|
||||||
if e.HealthCheck.Disable {
|
if e.HealthCheck.Disable {
|
||||||
e.HealthCheck = nil
|
e.HealthCheck = nil
|
||||||
|
} else {
|
||||||
|
if e.HealthCheck.Interval == 0 {
|
||||||
|
e.HealthCheck.Interval = common.HealthCheckIntervalDefault
|
||||||
|
}
|
||||||
|
if e.HealthCheck.Timeout == 0 {
|
||||||
|
e.HealthCheck.Timeout = common.HealthCheckTimeoutDefault
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if cont.IdleTimeout != "" {
|
if cont.IdleTimeout != "" {
|
||||||
|
|
|
@ -2,8 +2,6 @@ package health
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/yusing/go-proxy/internal/common"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type HealthCheckConfig struct {
|
type HealthCheckConfig struct {
|
||||||
|
@ -13,10 +11,3 @@ type HealthCheckConfig struct {
|
||||||
Interval time.Duration `json:"interval" yaml:"interval"`
|
Interval time.Duration `json:"interval" yaml:"interval"`
|
||||||
Timeout time.Duration `json:"timeout" yaml:"timeout"`
|
Timeout time.Duration `json:"timeout" yaml:"timeout"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func DefaultHealthCheckConfig() *HealthCheckConfig {
|
|
||||||
return &HealthCheckConfig{
|
|
||||||
Interval: common.HealthCheckIntervalDefault,
|
|
||||||
Timeout: common.HealthCheckTimeoutDefault,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue