Problem: item counts don't update
Solution: re-enable updateChannelUnreadCount
This commit is contained in:
parent
eba40a4eee
commit
8adfb56274
|
@ -860,19 +860,22 @@ func (b *memoryBackend) channelAddItem(channel string, item microsub.Item) (bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *memoryBackend) updateChannelUnreadCount(channel string) error {
|
func (b *memoryBackend) updateChannelUnreadCount(channel string) error {
|
||||||
// tl := b.getTimeline(channel)
|
tl := b.getTimeline(channel)
|
||||||
// unread, err := tl.Count()
|
unread, err := tl.Count()
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// return err
|
return err
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// currentCount := c.Unread.UnreadCount
|
var c microsub.Channel
|
||||||
// c.Unread = microsub.Unread{Type: microsub.UnreadCount, UnreadCount: unread}
|
c.UID = channel
|
||||||
//
|
|
||||||
// // Sent message to Server-Sent-Events
|
currentCount := c.Unread.UnreadCount
|
||||||
// if currentCount != unread {
|
c.Unread = microsub.Unread{Type: microsub.UnreadCount, UnreadCount: unread}
|
||||||
// b.broker.Notifier <- sse.Message{Event: "new item in channel", Object: c}
|
|
||||||
// }
|
// Sent message to Server-Sent-Events
|
||||||
|
if currentCount != unread {
|
||||||
|
b.broker.Notifier <- sse.Message{Event: "new item in channel", Object: c}
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -225,10 +225,11 @@ func (p *postgresStream) Count() (int, error) {
|
||||||
if row == nil {
|
if row == nil {
|
||||||
return 0, nil
|
return 0, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var count int
|
var count int
|
||||||
err = row.Scan(&count)
|
err = row.Scan(&count)
|
||||||
if err != nil {
|
if err != nil && err == sql.ErrNoRows {
|
||||||
return -1, err
|
return 0, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return count, nil
|
return count, nil
|
||||||
|
|
Loading…
Reference in New Issue
Block a user