fix chan recieve block on oom event
This commit is contained in:
parent
ee5bad8d84
commit
7fd7f20717
@ -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
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user