Fix a bug in EDU Typing handling in syncapi.

When a user's typing status times out, it must advance both the
Notifier and the EDUCache. This inconsistency meant that some Sytests
that only does a single `/sync` saw a returned event stream it didn't
expect (though empty), and failed.

In production, this likely just has the effect of adding extra load on
`/sync`, as the stream positions will resync the next time a user is
added or removed via API.
This commit is contained in:
Tommie Gannert 2021-10-19 11:48:18 +02:00
parent aa50371999
commit 10b3330511

View file

@ -74,6 +74,7 @@ func NewOutputTypingEventConsumer(
func (s *OutputTypingEventConsumer) Start() error {
s.eduCache.SetTimeoutCallback(func(userID, roomID string, latestSyncPosition int64) {
pos := types.StreamPosition(latestSyncPosition)
s.stream.Advance(pos)
s.notifier.OnNewTyping(roomID, types.StreamingToken{TypingPosition: pos})
})
return s.typingConsumer.Start()