1
0
Fork 0
mirror of https://github.com/eosswedenorg/thalos synced 2026-06-16 04:24:56 +02:00

transport/redis_pubsub/subscriber.go: implement Close()

This commit is contained in:
Henrik Hautakoski 2023-03-29 11:57:51 +02:00
parent 834adb6ca8
commit f174863a17

View file

@ -95,3 +95,14 @@ func (s *Subscriber) Read(channel transport.Channel) ([]byte, error) {
return <-ch, nil
}
func (s *Subscriber) Close() {
s.sub.Close()
for _, ch := range s.channels {
close(ch)
}
s.mu.Lock()
s.channels = make(map[string]chan []byte)
s.mu.Unlock()
}