mirror of
https://github.com/harness/drone.git
synced 2025-05-17 09:30:00 +08:00
Don't allow "logging" messages after eof is received
This commit is contained in:
parent
89607232bc
commit
c0fcc2dfed
@ -67,11 +67,15 @@ func LogStream(c *gin.Context) {
|
|||||||
|
|
||||||
logs := make(chan []byte)
|
logs := make(chan []byte)
|
||||||
done := make(chan bool)
|
done := make(chan bool)
|
||||||
|
var eof bool
|
||||||
dest := fmt.Sprintf("/topic/logs.%d", job.ID)
|
dest := fmt.Sprintf("/topic/logs.%d", job.ID)
|
||||||
client, _ := stomp.FromContext(c)
|
client, _ := stomp.FromContext(c)
|
||||||
sub, err := client.Subscribe(dest, stomp.HandlerFunc(func(m *stomp.Message) {
|
sub, err := client.Subscribe(dest, stomp.HandlerFunc(func(m *stomp.Message) {
|
||||||
if m.Header.GetBool("eof") {
|
if m.Header.GetBool("eof") {
|
||||||
|
eof = true
|
||||||
done <- true
|
done <- true
|
||||||
|
} else if eof {
|
||||||
|
return
|
||||||
} else {
|
} else {
|
||||||
logs <- m.Body
|
logs <- m.Body
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user