Forever loop over loki websocket can be stopped.
This commit is contained in:
parent
ae718e0557
commit
066d2a1dc5
1 changed files with 3 additions and 0 deletions
|
@ -351,6 +351,9 @@ func (l *LokiSource) StreamingAcquisition(out chan types.Event, t *tomb.Tomb) er
|
|||
defer c.Close()
|
||||
var resp Tail
|
||||
for { // draining the websocket
|
||||
if !t.Alive() { // someone want to close this loop
|
||||
return nil
|
||||
}
|
||||
t, msg, err := c.ReadMessage()
|
||||
if len(msg) == 0 {
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
|
|
Loading…
Add table
Reference in a new issue