Commit Graph

21 Commits

Author SHA1 Message Date
reivilibre
c2fe48a6ff
Rename the EventFormatVersions enum values so that they line up with room version numbers. () 2022-09-07 11:08:20 +01:00
Nick Mills-Barrett
cc21a431f3
Async get event cache prep ()
Some experimental prep work to enable external event caching based on  & . Doesn't actually move the cache at all, just lays the groundwork for async implemented caches.

Signed off by Nick @ Beeper (@Fizzadar)
2022-07-15 09:30:46 +00:00
Šimon Brandner
13e359aec8
Implement MSC3827: Filtering of /publicRooms by room type ()
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
2022-06-29 17:12:45 +00:00
Sumner Evans
bda4600399
LockStore: fix acquiring a lock via LockStore.try_acquire_lock ()
Signed-off-by: Sumner Evans <sumner@beeper.com>
2022-05-30 09:41:13 +01:00
Erik Johnston
fcf951d5dc
Track in memory events using weakrefs () 2022-05-17 10:34:27 +01:00
Richard van der Hoff
96e0cdbc5a
Add a consistency check on events read from the database ()
I've seen a few errors which can only plausibly be explained by the calculated
event id for an event being different from the ID of the event in the
database. It should be cheap to check this, so let's do so and raise an
exception.
2022-05-03 21:27:52 +01:00
Sean Quah
8a87b4435a
Handle cancellation in EventsWorkerStore._get_events_from_cache_or_db ()
Multiple calls to `EventsWorkerStore._get_events_from_cache_or_db` can
reuse the same database fetch, which is initiated by the first call.
Ensure that cancelling the first call doesn't cancel the other calls
sharing the same database fetch.

Signed-off-by: Sean Quah <seanq@element.io>
2022-04-25 19:39:17 +01:00
Richard van der Hoff
f0b03186d9
Add type hints for tests/unittest.py. ()
In particular, add type hints for get_success and friends, which are then helpful in a bunch of places.
2022-04-01 16:04:16 +00:00
Patrick Cloke
02d708568b
Replace assertEquals and friends with non-deprecated versions. () 2022-02-28 07:12:29 -05:00
Richard van der Hoff
e24ff8ebe3
Remove HomeServer.get_datastore() ()
The presence of this method was confusing, and mostly present for backwards
compatibility. Let's get rid of it.

Part of 
2022-02-23 11:04:02 +00:00
Sean Quah
c675a18071
Track ongoing event fetches correctly (again) ()
The previous fix for the ongoing event fetches counter
(8eec25a1d9) was both insufficient and
incorrect.

When the database is unreachable, `_do_fetch` never gets run and so
`_event_fetch_ongoing` is never decremented.

The previous fix also moved the `_event_fetch_ongoing` decrement outside
of the `_event_fetch_lock` which allowed race conditions to corrupt the
counter.
2021-11-26 13:47:24 +00:00
Brendan Abolivier
0d88c4f903
Improve performance of remove_{hidden,deleted}_devices_from_device_inbox ()
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
2021-11-25 15:14:54 +00:00
Dirk Klimpel
4535532526
Delete messages for hidden devices from device_inbox () 2021-11-02 13:18:30 +00:00
Dirk Klimpel
8d46fac98e
Delete messages from device_inbox table when deleting device ()
Fixes: 
2021-10-27 16:01:18 +01:00
David Robertson
370bca32e6
Don't drop user dir deltas when server leaves room ()
Fix a long-standing bug where a batch of user directory changes would be
silently dropped if the server left a room early in the batch.

* Pull out `wait_for_background_update` in tests

Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
2021-10-06 12:56:45 +00:00
Eric Eastwood
dc75fb7f05
Populate rooms.creator field for easy lookup ()
Part of https://github.com/matrix-org/synapse/pull/10566

 - Fill in creator whenever we insert into the rooms table
 - Add background update to backfill any missing creator values
2021-09-01 16:27:58 +01:00
reivilibre
642a42edde
Flatten the synapse.rest.client package () 2021-08-17 11:57:58 +00:00
Erik Johnston
c37dad67ab
Improve event caching code ()
Ensure we only load an event from the DB once when the same event is requested multiple times at once.
2021-08-04 13:54:51 +01:00
Erik Johnston
54389d5697
Fix dropping locks on shut down () 2021-07-20 14:24:25 +01:00
Erik Johnston
85d237eba7
Add a distributed lock ()
This adds a simple best effort locking mechanism that works cross workers.
2021-06-29 19:15:47 +01:00
Richard van der Hoff
b4b2fd2ece
add a cache to have_seen_event ()
Empirically, this helped my server considerably when handling gaps in Matrix HQ. The problem was that we would repeatedly call have_seen_events for the same set of (50K or so) auth_events, each of which would take many minutes to complete, even though it's only an index scan.
2021-06-01 12:04:47 +01:00