Merge pull request #151 from mlaventure/ctr-retrieve-missed-events
Retrieve ctr missed events once connection is re-established
This commit is contained in:
commit
a06dec80cd
1 changed files with 3 additions and 1 deletions
|
@ -577,13 +577,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