Notify account data without advancing PDU position in notifier

This commit is contained in:
Neil Alexander 2021-01-08 13:39:12 +00:00
parent d70ebaa1b9
commit 95e2e4d668
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
2 changed files with 10 additions and 1 deletions

View file

@ -97,7 +97,7 @@ func (s *OutputClientDataConsumer) onMessage(msg *sarama.ConsumerMessage) error
}
s.streams.AccountDataStreamProvider.Advance(pduPos)
s.notifier.OnNewEvent(nil, "", []string{string(msg.Key)}, types.StreamingToken{AccountDataPosition: pduPos})
s.notifier.OnNewAccountData(string(msg.Key), types.StreamingToken{AccountDataPosition: pduPos})
return nil
}

View file

@ -124,6 +124,15 @@ func (n *Notifier) OnNewEvent(
}
}
func (n *Notifier) OnNewAccountData(
userID string, posUpdate types.StreamingToken,
) {
n.streamLock.Lock()
defer n.streamLock.Unlock()
n.wakeupUsers([]string{userID}, nil, posUpdate)
}
func (n *Notifier) OnNewPeek(
roomID, userID, deviceID string,
) {