Merge pull request #462 from cpuguy83/stop_ticker

Ensure reconcile ticker stops on shutdown
This commit is contained in:
Paulo Pires
2018-12-12 12:55:19 +00:00
committed by GitHub

View File

@@ -99,14 +99,15 @@ func New(ctx context.Context, cfg Config) (s *Server, retErr error) {
return s, err
}
tick := time.Tick(5 * time.Second)
go func() {
tick := time.NewTicker(5 * time.Second)
defer tick.Stop()
for {
select {
case <-ctx.Done():
return
case <-tick:
case <-tick.C:
ctx, span := trace.StartSpan(ctx, "syncActualState")
s.updateNode(ctx)
s.updatePodStatuses(ctx)