mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-26 20:01:02 +00:00
Merge pull request #1940 from jmccann/log_stream_eof
Don't allow "logging" messages after eof is received
This commit is contained in:
commit
6b4fcc9684
1 changed files with 4 additions and 0 deletions
|
@ -67,11 +67,15 @@ func LogStream(c *gin.Context) {
|
|||
|
||||
logs := make(chan []byte)
|
||||
done := make(chan bool)
|
||||
var eof bool
|
||||
dest := fmt.Sprintf("/topic/logs.%d", job.ID)
|
||||
client, _ := stomp.FromContext(c)
|
||||
sub, err := client.Subscribe(dest, stomp.HandlerFunc(func(m *stomp.Message) {
|
||||
if m.Header.GetBool("eof") {
|
||||
eof = true
|
||||
done <- true
|
||||
} else if eof {
|
||||
return
|
||||
} else {
|
||||
logs <- m.Body
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue