Fix some edge cases with /sync (#302)

Including:
- Handle timeout=0 correctly
- Always return immediately on initial sync
- Handle spurious wake ups from the notifier
This commit is contained in:
Erik Johnston 2017-10-16 13:34:08 +01:00 committed by GitHub
parent 35b628f5bf
commit bd07447abe
4 changed files with 95 additions and 42 deletions

View file

@ -258,7 +258,7 @@ func TestNewEventAndWasPreviouslyJoinedToRoom(t *testing.T) {
func waitForEvents(n *Notifier, req syncRequest) (types.StreamPosition, error) {
done := make(chan types.StreamPosition, 1)
go func() {
newPos := n.WaitForEvents(req)
newPos := n.WaitForEvents(req, req.since)
done <- newPos
close(done)
}()