Skip to content

Commit

Permalink
fix: timer leak memory (#591)
Browse files Browse the repository at this point in the history
Co-authored-by: Leon <yuanfeng0905@haituncun.com>
  • Loading branch information
yuanfeng0905 and Leon committed Aug 4, 2021
1 parent 812e4bd commit 5635652
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/ingress/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -601,11 +601,13 @@ func (c *Controller) syncUpstreamNodesChangeToCluster(ctx context.Context, clust

func (c *Controller) checkClusterHealth(ctx context.Context, cancelFunc context.CancelFunc) {
defer cancelFunc()
t := time.NewTicker(5 * time.Second)
defer t.Stop()
for {
select {
case <-ctx.Done():
return
case <-time.After(5 * time.Second):
case <-t.C:
}

err := c.apisix.Cluster(c.cfg.APISIX.DefaultClusterName).HealthCheck(ctx)
Expand Down

0 comments on commit 5635652

Please sign in to comment.