Ensure reconcile ticker stops on shutdown
Otherwise this ticker could run forever (or until the process exits).
This commit is contained in:
@@ -106,14 +106,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)
|
||||
|
||||
Reference in New Issue
Block a user