Переглянути джерело

Wait for c8d process exit instead of polling API

In the containerd supervisor, instead of polling the healthcheck API
every 500 milliseconds we can just wait for the process to exit.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Brian Goff 5 роки тому
батько
коміт
bef73d8b07
1 змінених файлів з 9 додано та 0 видалено
  1. 9 0
      libcontainerd/supervisor/remote_daemon.go

+ 9 - 0
libcontainerd/supervisor/remote_daemon.go

@@ -300,6 +300,7 @@ func (r *remote) monitorDaemon(ctx context.Context) {
 				delay = 100 * time.Millisecond
 				delay = 100 * time.Millisecond
 				continue
 				continue
 			}
 			}
+			logrus.WithField("address", r.GRPC.Address).Debug("Created containerd monitoring client")
 		}
 		}
 
 
 		if client != nil {
 		if client != nil {
@@ -313,6 +314,14 @@ func (r *remote) monitorDaemon(ctx context.Context) {
 				}
 				}
 
 
 				transientFailureCount = 0
 				transientFailureCount = 0
+
+				select {
+				case <-r.daemonWaitCh:
+				case <-ctx.Done():
+				}
+
+				// Set a small delay in case there is a recurring failure (or bug in this code)
+				// to ensure we don't end up in a super tight loop.
 				delay = 500 * time.Millisecond
 				delay = 500 * time.Millisecond
 				continue
 				continue
 			}
 			}