fix chan recieve block on oom event

This commit is contained in:
Seth Jennings 2016-05-02 15:12:14 -05:00
parent ee5bad8d84
commit 7fd7f20717

View File

@ -144,17 +144,18 @@ func (self *OomParser) StreamOoms(outStream chan *OomInstance) {
oomCurrentInstance := &OomInstance{ oomCurrentInstance := &OomInstance{
ContainerName: "/", ContainerName: "/",
} }
finished := false for line := range lineChannel {
for !finished {
err := getContainerName(line, oomCurrentInstance) err := getContainerName(line, oomCurrentInstance)
if err != nil { if err != nil {
glog.Errorf("%v", err) glog.Errorf("%v", err)
} }
finished, err = getProcessNamePid(line, oomCurrentInstance) finished, err := getProcessNamePid(line, oomCurrentInstance)
if err != nil { if err != nil {
glog.Errorf("%v", err) glog.Errorf("%v", err)
} }
line = <-lineChannel if finished {
break
}
} }
outStream <- oomCurrentInstance outStream <- oomCurrentInstance
} }