Retrieve ctr missed events once connection is re-established
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
This commit is contained in:
parent
142e22a4dc
commit
2b8ae55b0b
1 changed files with 3 additions and 1 deletions
|
@ -568,13 +568,15 @@ var updateCommand = cli.Command{
|
||||||
}
|
}
|
||||||
|
|
||||||
func waitForExit(c types.APIClient, events types.API_EventsClient, id, pid string, closer func()) {
|
func waitForExit(c types.APIClient, events types.API_EventsClient, id, pid string, closer func()) {
|
||||||
|
timestamp := uint64(time.Now().Unix())
|
||||||
for {
|
for {
|
||||||
e, err := events.Recv()
|
e, err := events.Recv()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
time.Sleep(1 * time.Second)
|
time.Sleep(1 * time.Second)
|
||||||
events, _ = c.Events(netcontext.Background(), &types.EventsRequest{})
|
events, _ = c.Events(netcontext.Background(), &types.EventsRequest{Timestamp: timestamp})
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
timestamp = e.Timestamp
|
||||||
if e.Id == id && e.Type == "exit" && e.Pid == pid {
|
if e.Id == id && e.Type == "exit" && e.Pid == pid {
|
||||||
closer()
|
closer()
|
||||||
os.Exit(int(e.Status))
|
os.Exit(int(e.Status))
|
||||||
|
|
Loading…
Reference in a new issue