Only send 'delete channel' event when channel was removed
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
330931742b
commit
08ae30b305
|
@ -260,6 +260,14 @@ func (b *memoryBackend) ChannelsDelete(uid string) error {
|
|||
conn := b.pool.Get()
|
||||
defer conn.Close()
|
||||
|
||||
removed := false
|
||||
|
||||
b.lock.RLock()
|
||||
if _, e := b.Channels[uid]; e {
|
||||
removed = true
|
||||
}
|
||||
b.lock.RUnlock()
|
||||
|
||||
removeChannelFromRedis(conn, uid)
|
||||
|
||||
b.lock.Lock()
|
||||
|
@ -267,7 +275,9 @@ func (b *memoryBackend) ChannelsDelete(uid string) error {
|
|||
delete(b.Feeds, uid)
|
||||
b.lock.Unlock()
|
||||
|
||||
b.broker.Notifier <- sse.Message{Event: "delete channel", Object: channelDeletedMessage{1, uid}}
|
||||
if removed {
|
||||
b.broker.Notifier <- sse.Message{Event: "delete channel", Object: channelDeletedMessage{1, uid}}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user