diff options
author | Kegsay <kegan@matrix.org> | 2020-05-06 18:03:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-06 18:03:25 +0100 |
commit | 3b98535dc5d85a36168c857da55b17d4ab030f9d (patch) | |
tree | 65de50162210b21b1260e966584d5d4490756640 /clientapi | |
parent | 12948522703570e25cd7bacdfdaa81deba988131 (diff) |
only send new events to RS; add tests for /state_ids and /event (#1011)
* only send new events to RS; add tests for /state_ids and /event
* Review comments: send in auth event order
* Ignore order of state events for this test as RespState.Events is non-deterministic
Diffstat (limited to 'clientapi')
-rw-r--r-- | clientapi/producers/roomserver.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/clientapi/producers/roomserver.go b/clientapi/producers/roomserver.go index 7eee83f5..f0733db9 100644 --- a/clientapi/producers/roomserver.go +++ b/clientapi/producers/roomserver.go @@ -52,9 +52,10 @@ func (c *RoomserverProducer) SendEvents( } // SendEventWithState writes an event with KindNew to the roomserver input log -// with the state at the event as KindOutlier before it. +// with the state at the event as KindOutlier before it. Will not send any event that is +// marked as `true` in haveEventIDs func (c *RoomserverProducer) SendEventWithState( - ctx context.Context, state *gomatrixserverlib.RespState, event gomatrixserverlib.HeaderedEvent, + ctx context.Context, state *gomatrixserverlib.RespState, event gomatrixserverlib.HeaderedEvent, haveEventIDs map[string]bool, ) error { outliers, err := state.Events() if err != nil { @@ -63,6 +64,9 @@ func (c *RoomserverProducer) SendEventWithState( var ires []api.InputRoomEvent for _, outlier := range outliers { + if haveEventIDs[outlier.EventID()] { + continue + } ires = append(ires, api.InputRoomEvent{ Kind: api.KindOutlier, Event: outlier.Headered(event.RoomVersion), |