Only update unread count when it has changed
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
53b4e748c3
commit
46c308619e
|
@ -661,10 +661,14 @@ func (b *memoryBackend) updateChannelUnreadCount(channel string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer b.save()
|
defer b.save()
|
||||||
|
|
||||||
|
currentCount := c.Unread.UnreadCount
|
||||||
c.Unread = microsub.Unread{Type: microsub.UnreadCount, UnreadCount: unread}
|
c.Unread = microsub.Unread{Type: microsub.UnreadCount, UnreadCount: unread}
|
||||||
|
|
||||||
// Sent message to Server-Sent-Events
|
// 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.lock.Lock()
|
||||||
b.Channels[channel] = c
|
b.Channels[channel] = c
|
||||||
|
|
Loading…
Reference in New Issue
Block a user