From 2b8ae55b0b670fa5669d81748f5b1f6c3e1c5dd9 Mon Sep 17 00:00:00 2001 From: Kenfe-Mickael Laventure Date: Tue, 22 Mar 2016 10:38:47 -0700 Subject: [PATCH] Retrieve ctr missed events once connection is re-established Signed-off-by: Kenfe-Mickael Laventure --- ctr/container.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ctr/container.go b/ctr/container.go index aa8d9e3..b719101 100644 --- a/ctr/container.go +++ b/ctr/container.go @@ -568,13 +568,15 @@ var updateCommand = cli.Command{ } func waitForExit(c types.APIClient, events types.API_EventsClient, id, pid string, closer func()) { + timestamp := uint64(time.Now().Unix()) for { e, err := events.Recv() if err != nil { time.Sleep(1 * time.Second) - events, _ = c.Events(netcontext.Background(), &types.EventsRequest{}) + events, _ = c.Events(netcontext.Background(), &types.EventsRequest{Timestamp: timestamp}) continue } + timestamp = e.Timestamp if e.Id == id && e.Type == "exit" && e.Pid == pid { closer() os.Exit(int(e.Status))