summary refs log tree commit diff
path: root/tests/state (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Fix mainline ordering in state res v2 (#8971)Erik Johnston2020-12-181-1/+56
| | | | | | This had two effects 1) it'd give the wrong answer and b) would iterate *all* power levels in the auth chain of each event. The latter of which can be *very* expensive for certain types of IRC bridge rooms that have large numbers of power level changes.
* Pass room_id to get_auth_chain_difference (#8879)Erik Johnston2020-12-041-4/+10
| | | | | This is so that we can choose which algorithm to use based on the room ID.
* Correctly handle unpersisted events when calculating auth chain difference. ↵Erik Johnston2020-12-021-1/+127
| | | | | | | | | (#8827) We do state res with unpersisted events when calculating the new current state of the room, so that should be the only thing impacted. I don't think this is tooooo big of a deal as: 1. the next time a state event happens in the room the current state should correct itself; 2. in the common case all the unpersisted events' auth events will be pulled in by other state, so will still return the correct result (or one which is sufficiently close to not affect the result); and 3. we mostly use the state at an event to do important operations, which isn't affected by this.
* Stop sub-classing object (#8249)Patrick Cloke2020-09-041-2/+2
|
* Convert state resolution to async/await (#7942)Patrick Cloke2020-07-241-7/+10
|
* Yield during large v2 state res. (#7735)Erik Johnston2020-06-241-0/+9
| | | | | | | | | | | State res v2 across large data sets can be very CPU intensive, and if all the relevant events are in the cache the algorithm will run from start to finish within a single reactor tick. This can result in blocking the reactor tick for several seconds, which can have major repercussions on other requests. To fix this we simply add the occaisonal `sleep(0)` during iterations to yield execution until the next reactor tick. The aim is to only do this for large data sets so that we don't impact otherwise quick resolutions.=
* Replace all remaining six usage with native Python 3 equivalents (#7704)Dagfinn Ilmari Mannsåker2020-06-161-2/+0
|
* Improve get auth chain difference algorithm. (#7095)Erik Johnston2020-03-181-5/+8
| | | | | | | | | | | It was originally implemented by pulling the full auth chain of all state sets out of the database and doing set comparison. However, that can take a lot work if the state and auth chains are large. Instead, lets try and fetch the auth chains at the same time and calculate the difference on the fly, allowing us to bail early if all the auth chains converge. Assuming that the auth chains do converge more often than not, this should improve performance. Hopefully.
* Reduce auth chains fetched during v2 state res. (#6952)Erik Johnston2020-02-191-2/+4
| | | | | | The state res v2 algorithm only cares about the difference between auth chains, so we can pass in the known common state to the `get_auth_chain` storage function so that it can ignore those events.
* Add a `make_event_from_dict` method (#6858)Richard van der Hoff2020-02-071-2/+2
| | | | | | | ... and use it in places where it's trivial to do so. This will make it easier to pass room versions into the FrozenEvent constructors.
* sanity-checking for events used in state res (#6531)Richard van der Hoff2019-12-131-0/+3
| | | | | | | When we perform state resolution, check that all of the events involved are in the right room.
* Run Black. (#5482)Amber Brown2019-06-201-10/+10
|
* Run Black on the tests again (#5170)Amber Brown2019-05-101-165/+39
|
* Collect room-version variations into one place (#4969)Richard van der Hoff2019-04-011-3/+4
| | | | Collect all the things that make room-versions different to one another into one place, so that it's easier to define new room versions.
* Pass through room version to event authErik Johnston2019-01-251-1/+3
|
* Add helpers for getting prev and auth events (#4139)Erik Johnston2018-11-061-1/+1
| | | | | | | * Add helpers for getting prev and auth events This is in preparation for allowing the event format to change between room versions.
* Fix None exception in state res v2Erik Johnston2018-11-021-2/+98
|
* isortErik Johnston2018-10-241-4/+1
|
* Rename resolve_events_with_factoryErik Johnston2018-10-241-2/+2
|
* Add some state res v2 testsErik Johnston2018-10-162-0/+666