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
|
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)
|
||||||
|
|||||||
Reference in New Issue
Block a user