forked from MirrorHub/synapse
Fix bug where we clobbered old state group values
This commit is contained in:
parent
cabead6194
commit
1d2a0040cf
3 changed files with 13 additions and 2 deletions
|
@ -346,6 +346,8 @@ class FederationHandler(BaseHandler):
|
||||||
event.get_pdu_json()
|
event.get_pdu_json()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
handled_events = set()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
builder.event_id = self.event_factory.create_event_id()
|
builder.event_id = self.event_factory.create_event_id()
|
||||||
builder.origin = self.hs.hostname
|
builder.origin = self.hs.hostname
|
||||||
|
@ -371,6 +373,10 @@ class FederationHandler(BaseHandler):
|
||||||
auth_chain = ret["auth_chain"]
|
auth_chain = ret["auth_chain"]
|
||||||
auth_chain.sort(key=lambda e: e.depth)
|
auth_chain.sort(key=lambda e: e.depth)
|
||||||
|
|
||||||
|
handled_events.update([s.event_id for s in state])
|
||||||
|
handled_events.update([a.event_id for a in auth_chain])
|
||||||
|
handled_events.add(new_event.event_id)
|
||||||
|
|
||||||
logger.debug("do_invite_join auth_chain: %s", auth_chain)
|
logger.debug("do_invite_join auth_chain: %s", auth_chain)
|
||||||
logger.debug("do_invite_join state: %s", state)
|
logger.debug("do_invite_join state: %s", state)
|
||||||
|
|
||||||
|
@ -426,6 +432,9 @@ class FederationHandler(BaseHandler):
|
||||||
del self.room_queues[room_id]
|
del self.room_queues[room_id]
|
||||||
|
|
||||||
for p, origin in room_queue:
|
for p, origin in room_queue:
|
||||||
|
if p.event_id in handled_events:
|
||||||
|
continue
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.on_receive_pdu(origin, p, backfilled=False)
|
self.on_receive_pdu(origin, p, backfilled=False)
|
||||||
except:
|
except:
|
||||||
|
|
|
@ -220,6 +220,7 @@ class DataStore(RoomMemberStore, RoomStore,
|
||||||
room_id=event.room_id,
|
room_id=event.room_id,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if not outlier:
|
||||||
self._store_state_groups_txn(txn, event, context)
|
self._store_state_groups_txn(txn, event, context)
|
||||||
|
|
||||||
if current_state:
|
if current_state:
|
||||||
|
|
|
@ -29,7 +29,8 @@ CREATE TABLE IF NOT EXISTS state_groups_state(
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS event_to_state_groups(
|
CREATE TABLE IF NOT EXISTS event_to_state_groups(
|
||||||
event_id TEXT NOT NULL,
|
event_id TEXT NOT NULL,
|
||||||
state_group INTEGER NOT NULL
|
state_group INTEGER NOT NULL,
|
||||||
|
CONSTRAINT event_to_state_groups_uniq UNIQUE (event_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS state_groups_id ON state_groups(id);
|
CREATE INDEX IF NOT EXISTS state_groups_id ON state_groups(id);
|
||||||
|
|
Loading…
Reference in a new issue