Forever loop over loki websocket can be stopped.

This commit is contained in:
Mathieu Lecarme 2022-06-17 15:07:54 +02:00 committed by lperdereau
parent ae718e0557
commit 066d2a1dc5

View file

@ -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)