Close the websocket.
This commit is contained in:
parent
066d2a1dc5
commit
3471ce066e
|
@ -340,6 +340,10 @@ func (l *LokiSource) StreamingAcquisition(out chan types.Event, t *tomb.Tomb) er
|
|||
for {
|
||||
ctx, cancel := context.WithTimeout(context.TODO(), readyTimeout)
|
||||
defer cancel()
|
||||
go func() {
|
||||
<-t.Dying()
|
||||
cancel() // close the websocket.
|
||||
}()
|
||||
c, res, err := l.dialer.DialContext(ctx, l.lokiWebsocket, l.header)
|
||||
if err != nil {
|
||||
buf, err2 := ioutil.ReadAll(res.Body)
|
||||
|
|
Loading…
Reference in a new issue