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 return s, err
} }
tick := time.Tick(5 * time.Second)
go func() { go func() {
tick := time.NewTicker(5 * time.Second)
defer tick.Stop()
for { for {
select { select {
case <-ctx.Done(): case <-ctx.Done():
return return
case <-tick: case <-tick.C:
ctx, span := trace.StartSpan(ctx, "syncActualState") ctx, span := trace.StartSpan(ctx, "syncActualState")
s.updateNode(ctx) s.updateNode(ctx)
s.updatePodStatuses(ctx) s.updatePodStatuses(ctx)