Exclude old state events from sync when consumed from roomserver (#1548)
* Exclude old room events from sync when consumed from roomserver * Fix comment * Experimental hackmain
parent
3afc623098
commit
f32320a235
|
@ -189,14 +189,20 @@ func (s *OutputRoomEventConsumer) onOldRoomEvent(
|
||||||
) error {
|
) error {
|
||||||
ev := msg.Event
|
ev := msg.Event
|
||||||
|
|
||||||
|
// TODO: The state key check when excluding from sync is designed
|
||||||
|
// to stop us from lying to clients with old state, whilst still
|
||||||
|
// allowing normal timeline events through. This is an absolute
|
||||||
|
// hack but until we have some better strategy for dealing with
|
||||||
|
// old events in the sync API, this should at least prevent us
|
||||||
|
// from confusing clients into thinking they've joined/left rooms.
|
||||||
pduPos, err := s.db.WriteEvent(
|
pduPos, err := s.db.WriteEvent(
|
||||||
ctx,
|
ctx,
|
||||||
&ev,
|
&ev,
|
||||||
[]gomatrixserverlib.HeaderedEvent{},
|
[]gomatrixserverlib.HeaderedEvent{},
|
||||||
[]string{}, // adds no state
|
[]string{}, // adds no state
|
||||||
[]string{}, // removes no state
|
[]string{}, // removes no state
|
||||||
nil, // no transaction
|
nil, // no transaction
|
||||||
false, // not excluded from sync
|
ev.StateKey() != nil, // exclude from sync?
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// panic rather than continue with an inconsistent database
|
// panic rather than continue with an inconsistent database
|
||||||
|
|
Loading…
Reference in New Issue