prevent panic when replaying on closed channel
This commit is contained in:
parent
0ec2a65067
commit
6165030ab5
1 changed files with 6 additions and 0 deletions
|
@ -111,6 +111,12 @@ func (c *Channel) start() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func replay(s *Subscription, history []interface{}) {
|
func replay(s *Subscription, history []interface{}) {
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
log.Println("recoved from panic", r)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
for _, msg := range history {
|
for _, msg := range history {
|
||||||
s.send <- msg
|
s.send <- msg
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue