Browse code

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 authored on 2019/10/17 04:23:10
Showing 1 changed files
... ...
@@ -300,6 +300,7 @@ func (r *remote) monitorDaemon(ctx context.Context) {
300 300
 				delay = 100 * time.Millisecond
301 301
 				continue
302 302
 			}
303
+			logrus.WithField("address", r.GRPC.Address).Debug("Created containerd monitoring client")
303 304
 		}
304 305
 
305 306
 		if client != nil {
... ...
@@ -313,6 +314,14 @@ func (r *remote) monitorDaemon(ctx context.Context) {
313 313
 				}
314 314
 
315 315
 				transientFailureCount = 0
316
+
317
+				select {
318
+				case <-r.daemonWaitCh:
319
+				case <-ctx.Done():
320
+				}
321
+
322
+				// Set a small delay in case there is a recurring failure (or bug in this code)
323
+				// to ensure we don't end up in a super tight loop.
316 324
 				delay = 500 * time.Millisecond
317 325
 				continue
318 326
 			}