diff options
author | David Robertson <davidr@element.io> | 2023-03-13 12:31:19 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-13 12:31:19 +0000 |
commit | c071cd5a0ebc2983e5576036ffef3668ba2a30cd (patch) | |
tree | c20ce9281825351ede8b4da1f400dda2b9803b36 /tests/test_utils | |
parent | Refactor `filter_events_for_server` (#15240) (diff) | |
download | synapse-c071cd5a0ebc2983e5576036ffef3668ba2a30cd.tar.xz |
Ensure fed-sender catchup does not block for full state (#15248)
* Reproduce bad scenario in test * Avoid catchup optimisation for partial state rooms
Diffstat (limited to 'tests/test_utils')
-rw-r--r-- | tests/test_utils/event_injection.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/test_utils/event_injection.py b/tests/test_utils/event_injection.py index a6330ed840..9679904c33 100644 --- a/tests/test_utils/event_injection.py +++ b/tests/test_utils/event_injection.py @@ -102,3 +102,34 @@ async def create_event( context = await unpersisted_context.persist(event) return event, context + + +async def mark_event_as_partial_state( + hs: synapse.server.HomeServer, + event_id: str, + room_id: str, +) -> None: + """ + (Falsely) mark an event as having partial state. + + Naughty, but occasionally useful when checking that partial state doesn't + block something from happening. + + If the event already has partial state, this insert will fail (event_id is unique + in this table). + """ + store = hs.get_datastores().main + await store.db_pool.simple_upsert( + table="partial_state_rooms", + keyvalues={"room_id": room_id}, + values={}, + insertion_values={"room_id": room_id}, + ) + + await store.db_pool.simple_insert( + table="partial_state_events", + values={ + "room_id": room_id, + "event_id": event_id, + }, + ) |