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:
parent
834adb6ca8
commit
f174863a17
1 changed files with 11 additions and 0 deletions
|
|
@ -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()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue