Skip to content

Commit dd8befb

Browse files
committed
docker container monitoring enhancements
1 parent 0c3f3db commit dd8befb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

internal/app/master/inspectors/container/container_inspector.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ func (i *Inspector) RunContainer() error {
271271

272272
if devent.ID == i.ContainerID {
273273
if devent.Status == "die" {
274+
//TODO: update the docker client library to get the exit status to know if it really crashed
274275
if i.PrintState {
275276
fmt.Printf("%s info=container status=crashed id=%v\n", i.PrintPrefix, i.ContainerID)
276277
}
@@ -437,8 +438,6 @@ func (i *Inspector) showContainerLogs() {
437438

438439
// ShutdownContainer terminates the container inspector instance execution
439440
func (i *Inspector) ShutdownContainer() error {
440-
close(i.dockerEventStopCh)
441-
442441
i.shutdownContainerChannels()
443442

444443
if i.ShowContainerLogs {
@@ -470,6 +469,9 @@ func (i *Inspector) ShutdownContainer() error {
470469

471470
// FinishMonitoring ends the target container monitoring activities
472471
func (i *Inspector) FinishMonitoring() {
472+
close(i.dockerEventStopCh)
473+
i.dockerEventStopCh = nil
474+
473475
cmdResponse, err := ipc.SendContainerCmd(&command.StopMonitor{})
474476
errutils.WarnOn(err)
475477
//_ = cmdResponse

0 commit comments

Comments
 (0)