Only update unread count when it has changed
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Peter Stuifzand 2019-08-17 22:08:22 +02:00
parent 53b4e748c3
commit 46c308619e
Signed by: peter
GPG Key ID: 374322D56E5209E8

View File

@ -661,10 +661,14 @@ func (b *memoryBackend) updateChannelUnreadCount(channel string) error {
return err
}
defer b.save()
currentCount := c.Unread.UnreadCount
c.Unread = microsub.Unread{Type: microsub.UnreadCount, UnreadCount: unread}
// Sent message to Server-Sent-Events
b.broker.Notifier <- sse.Message{Event: "new item in channel", Object: c}
if currentCount != unread {
b.broker.Notifier <- sse.Message{Event: "new item in channel", Object: c}
}
b.lock.Lock()
b.Channels[channel] = c