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