aboutsummaryrefslogtreecommitdiff
path: root/federationsender/consumers
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2020-10-22 10:39:16 +0100
committerGitHub <noreply@github.com>2020-10-22 10:39:16 +0100
commit3afc623098dc2cc24093466f69e1d9c4bac9d35b (patch)
tree401f20e9ab2c47a1caef5e295f374118ecfcb7d3 /federationsender/consumers
parent04dc019e5e2f60cd387699bb7f4f7eead15ba714 (diff)
Fix RewritesState bug (#1557)
* Set RewritesState once * Check if any new state provided * Obey rewritesState * Don't nuke everything the sync API knows when purging state * Fix panic from duplicate insert * Consistency * Use HasState * Remove nolint * Clean up joined rooms on state rewrite
Diffstat (limited to 'federationsender/consumers')
-rw-r--r--federationsender/consumers/roomserver.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/federationsender/consumers/roomserver.go b/federationsender/consumers/roomserver.go
index efeb53fa..ef945694 100644
--- a/federationsender/consumers/roomserver.go
+++ b/federationsender/consumers/roomserver.go
@@ -87,6 +87,12 @@ func (s *OutputRoomEventConsumer) onMessage(msg *sarama.ConsumerMessage) error {
case api.OutputTypeNewRoomEvent:
ev := &output.NewRoomEvent.Event
+ if output.NewRoomEvent.RewritesState {
+ if err := s.db.PurgeRoomState(context.TODO(), ev.RoomID()); err != nil {
+ return fmt.Errorf("s.db.PurgeRoom: %w", err)
+ }
+ }
+
if err := s.processMessage(*output.NewRoomEvent); err != nil {
// panic rather than continue with an inconsistent database
log.WithFields(log.Fields{