This commit is contained in:
Neil Alexander 2021-01-20 09:35:44 +00:00
parent 9d406e1283
commit dd781907b1
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
2 changed files with 0 additions and 26 deletions

View file

@ -42,7 +42,6 @@ func Setup(
r0mux := csMux.PathPrefix("/r0").Subrouter()
// TODO: Add AS support for all handlers below.
// asdf
r0mux.Handle("/sync", httputil.MakeAuthAPI("sync", userAPI, func(req *http.Request, device *userapi.Device) util.JSONResponse {
return srp.OnIncomingSyncRequest(req, device)
})).Methods(http.MethodGet, http.MethodOptions)

View file

@ -143,14 +143,6 @@ func (p *PDUStreamProvider) IncrementalSync(
}
}
logrus.WithFields(logrus.Fields{
"stateFilter": fmt.Sprintf("%+v", stateFilter),
"from": from,
"to": to,
"req.WantFullState": req.WantFullState,
"stateDeltas": stateDeltas,
}).Info("IncrementalSync")
for _, roomID := range joinedRooms {
req.Rooms[roomID] = gomatrixserverlib.Join
}
@ -190,12 +182,6 @@ func (p *PDUStreamProvider) addRoomDeltaToResponse(
return err
}
logrus.WithFields(logrus.Fields{
"limited": limited,
"delta.stateEvents": len(delta.StateEvents),
"recentStreamEvents": len(recentStreamEvents),
}).Info("isync addRoomDeltaToResponse removeDuplicates")
recentEvents := p.DB.StreamEventsToEvents(device, recentStreamEvents)
delta.StateEvents = removeDuplicates(delta.StateEvents, recentEvents) // roll back
prevBatch, err := p.DB.GetBackwardTopologyPos(ctx, recentStreamEvents)
@ -270,23 +256,12 @@ func (p *PDUStreamProvider) getResponseForCompleteSync(
recentStreamEvents, limited = p.filterStreamEventsAccordingToHistoryVisibility(recentStreamEvents, stateEvents, device, limited)
// TODO: How do we apply filter.Room.State to this as well?
// Is there a generic function where we can pass a list of events and filter and get the result?
// This is based off of Synapse where we derive the state from the resultant timeline events
// https://github.com/matrix-org/synapse/blob/14950a45d6ff3a5ea737322af1096a49b079f2eb/synapse/handlers/sync.py#L791-L795
for _, event := range recentStreamEvents {
if event.HeaderedEvent.Event.StateKey() != nil {
stateEvents = append(stateEvents, event.HeaderedEvent)
}
}
// Note: I feel like this is flawed. We only want stateEvents in the events we filtered already
// so I've opted with the option above to derive the `stateEvents`
// stateEvents, err = p.DB.CurrentState(ctx, roomID, &filter.Room.State)
// if err != nil {
// return
// }
// Retrieve the backward topology position, i.e. the position of the
// oldest event in the room's topology.
if len(recentStreamEvents) > 0 {