Skip to content

Commit

Permalink
fix ci
Browse files Browse the repository at this point in the history
  • Loading branch information
ztelur committed May 19, 2022
1 parent b5616d2 commit 985541e
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions pkg/cluster/healthcheck/healthcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package healthcheck

import (
"runtime/debug"
"sync"
"sync/atomic"
"time"
)
Expand Down Expand Up @@ -67,6 +69,8 @@ type EndpointChecker struct {
unHealthCount uint32
healthCount uint32
threshold uint32

once sync.Once
}

type checkResponse struct {
Expand All @@ -78,19 +82,19 @@ func CreateHealthCheck(cluster *model.ClusterConfig, cfg model.HealthCheckConfig

timeout, err := time.ParseDuration(cfg.TimeoutConfig)
if err != nil {
logger.Infof("[health check] timeout parse duration error %s", cfg.TimeoutConfig)
logger.Infof("[health check] timeout parse duration error %s", err)
timeout = DefaultTimeout
}

interval, err := time.ParseDuration(cfg.IntervalConfig)
if err != nil {
logger.Infof("[health check] interval parse duration error %s", cfg.TimeoutConfig)
logger.Infof("[health check] interval parse duration error %s", err)
interval = DefaultInterval
}

initialDelay, err := time.ParseDuration(cfg.IntervalConfig)
if err != nil {
logger.Infof("[health check] initialDelay parse duration error %s", cfg.TimeoutConfig)
logger.Infof("[health check] initialDelay parse duration error %s", err)
initialDelay = DefaultFirstInterval
}

Expand Down Expand Up @@ -226,7 +230,9 @@ func (c *EndpointChecker) Start() {
}

func (c *EndpointChecker) Stop() {
close(c.stop)
c.once.Do(func() {
close(c.stop)
})
}

func (c *EndpointChecker) HandleSuccess() {
Expand Down

0 comments on commit 985541e

Please sign in to comment.