Skip to content

Commit

Permalink
Fixing when mesos-agent is unreachable for log fetching.
Browse files Browse the repository at this point in the history
If we couldn't get the logs from the agent, it would block inside the
case <-timer select making the main thread not be able to handle
messages sent to StatusUpdate nor ResourceOffers resulting in consuming
the entire cluster :(. This is a stop gap until I figure out how to
properly fix this.
  • Loading branch information
hekaldama committed May 28, 2016
1 parent c63888d commit 73c3e44
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions main.go
Expand Up @@ -232,16 +232,19 @@ func printLogs() {
}
case <-timer:
if readableStatus != nil {
if finished {
time.Sleep(3 * time.Second)
}
x := printLog(readableStatus, oout, os.Stdout)
y := printLog(readableStatus, oerr, os.Stderr)
if finished && x == 0 && y == 0 {
return
}
oout += x
oerr += y
go func() {
if finished {
time.Sleep(3 * time.Second)
}
x := printLog(readableStatus, oout, os.Stdout)
y := printLog(readableStatus, oerr, os.Stderr)
if finished && x == 0 && y == 0 {
log.V(1).Infof("framework terminating")
os.Exit(exitStatus)
}
oout += x
oerr += y
}()
}
}
}
Expand Down Expand Up @@ -378,6 +381,4 @@ func main() {
}()

printLogs()
log.V(1).Infof("framework terminating")
os.Exit(exitStatus)
}

0 comments on commit 73c3e44

Please sign in to comment.