summary refs log tree commit diff
path: root/tests/util (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Use deferred.addTimeout instead of time_bound_deferredRichard van der Hoff2018-04-231-33/+0
| | | | This doesn't feel like a wheel we need to reinvent.
* Fix overzealous cache invalidationRichard van der Hoff2018-04-051-0/+46
| | | | | Fixes an issue where a cache invalidation would invalidate *all* pending entries, rather than just the entry that we intended to invalidate.
* Merge pull request #2804 from matrix-org/erikj/file_consumerErik Johnston2018-01-181-0/+176
|\ | | | | Add decent impl of a FileConsumer
| * Move test stuff to testsErik Johnston2018-01-181-8/+46
| |
| * Add decent impl of a FileConsumerErik Johnston2018-01-171-0/+138
| | | | | | | | | | | | | | | | | | | | Twisted core doesn't have a general purpose one, so we need to write one ourselves. Features: - All writing happens in background thread - Supports both push and pull producers - Push producers get paused if the consumer falls behind
* | Optimise LoggingContext creation and copyingRichard van der Hoff2018-01-161-8/+8
|/ | | | | | | | It turns out that the only thing we use the __dict__ of LoggingContext for is `request`, and given we create lots of LoggingContexts and then copy them every time we do a db transaction or log line, using the __dict__ seems a bit redundant. Let's try to optimise things by making the request attribute explicit.
* Fix name of test_logcontextRichard van der Hoff2017-10-171-0/+0
| | | | The file under test is logcontext.py, not log_context.py
* Add some tests for make_deferred_yieldableRichard van der Hoff2017-10-171-0/+38
|
* Fix stackoverflow and logcontexts from linearizerRichard van der Hoff2017-10-111-4/+24
| | | | | | | 1. make it not blow out the stack when there are more than 50 things waiting for a lock. Fixes https://github.com/matrix-org/synapse/issues/2505. 2. Make it not mess up the log contexts.
* Make get_state_groups_from_groups faster.Erik Johnston2017-05-171-1/+1
| | | | | | | | | Most of the time was spent copying a dict to filter out sentinel values that indicated that keys did not exist in the dict. The sentinel values were added to ensure that we cached the non-existence of keys. By updating DictionaryCache to keep track of which keys were known to not exist itself we can remove a dictionary copy.
* Fix up testsErik Johnston2017-03-302-1/+41
|
* Fix the logcontext handling in the cache wrappers (#2077)Richard van der Hoff2017-03-301-0/+91
| | | | | | | The cache wrappers had a habit of leaking the logcontext into the reactor while the lookup function was running, and then not restoring it correctly when the lookup function had completed. It's all the fault of `preserve_context_over_{fn,deferred}` which are basically a bit broken.
* Merge pull request #2052 from matrix-org/rav/time_bound_deferredRichard van der Hoff2017-03-231-0/+33
|\ | | | | Fix time_bound_deferred to throw the right exception
| * Fix time_bound_deferred to throw the right exceptionRichard van der Hoff2017-03-231-0/+33
| | | | | | | | | | | | Due to a failure to instantiate DeferredTimedOutError, time_bound_deferred would throw a CancelledError when the deferred timed out, which was rather confusing.
* | Fix caching of remote servers' signature keysRichard van der Hoff2017-03-222-0/+100
|/ | | | | | | | | The `@cached` decorator on `KeyStore._get_server_verify_key` was missing its `num_args` parameter, which meant that it was returning the wrong key for any server which had more than one recorded key. By way of a fix, change the default for `num_args` to be *all* arguments. To implement that, factor out a common base class for `CacheDescriptor` and `CacheListDescriptor`.
* Stop preserve_fn leaking context into the reactorRichard van der Hoff2017-03-181-0/+61
| | | | | | | | Fix a bug in ``logcontext.preserve_fn`` which made it leak context into the reactor, and add a test for it. Also, get rid of ``logcontext.reset_context_after_deferred``, which tried to do the same thing but had its own, different, set of bugs.
* Tidy up testErik Johnston2017-01-171-12/+12
|
* Speed up cache size calculationErik Johnston2017-01-171-15/+15
| | | | | | | | | | | Instead of calculating the size of the cache repeatedly, which can take a long time now that it can use a callback, instead cache the size and update that on insertion and deletion. This requires changing the cache descriptors to have two caches, one for pending deferreds and the other for the actual values. There's no reason to evict from the pending deferreds as they won't take up any more memory.
* Add ExpiringCache testsErik Johnston2017-01-161-0/+84
|
* Optionally measure size of cache by sum of length of valuesErik Johnston2017-01-131-0/+25
|
* Add Limiter: limit concurrent access to resourceErik Johnston2016-11-101-0/+70
|
* Ensure invalidation list does not grow unboundedlyErik Johnston2016-08-191-0/+40
|
* Add concept of cache contextsErik Johnston2016-08-191-0/+113
|
* Add ReadWriteLockErik Johnston2016-07-051-0/+85
|
* Deduplicate joinsErik Johnston2016-04-071-0/+44
|
* Add a test for TreeCache.__contains__Mark Haines2016-02-221-0/+6
|
* Fix flake8 warnings for testsMark Haines2016-02-194-2/+2
|
* Add wheeltimer implErik Johnston2016-02-171-0/+74
|
* Fix testErik Johnston2016-02-091-9/+1
|
* Add testsErik Johnston2016-01-292-0/+19
|
* Revert all the bits changing keys of eeverything that used LRUCaches to tuplesDavid Baker2016-01-221-22/+22
|
* Make LRU cache not default to treecache & add options to use itDavid Baker2016-01-221-1/+2
|
* Test treecache directlyDavid Baker2016-01-221-0/+19
|
* Add tests for treecache directly and test del_multi at the LruCache level too.David Baker2016-01-221-0/+66
|
* Change LRUCache to be tree-based so we can delete subtrees.David Baker2016-01-211-22/+22
|
* copyrightsMatthew Hodgson2016-01-074-4/+4
|
* Add a unit test for the snapshot cacheMark Haines2015-12-231-0/+60
|
* Remove the LockManager class because it wasn't being usedMark Haines2015-11-041-108/+0
|
* Move all the caches into their own package, synapse.util.cachesErik Johnston2015-08-112-4/+2
|
* Move DictionaryCacheErik Johnston2015-08-041-1/+1
|
* Add basic dictionary cacheErik Johnston2015-08-041-0/+101
|
* Add a lru cache classMark Haines2015-02-111-0/+56
|
* Add a request-id to each log lineMark Haines2014-10-301-0/+43
|
* Have all unit tests import from our own subclass of trial's unittest ↵Paul "LeoNerd" Evans2014-09-121-2/+2
| | | | TestCase; set up logging in ONE PLACE ONLY
* fix the copyright holder from matrix.org to OpenMarket Ltd, as matrix.org ↵Matthew Hodgson2014-09-032-2/+2
| | | | hasn't been incorporated in time for launch.
* add in copyrights to everything, not just the synapse subdir, and add a ↵Matthew Hodgson2014-08-132-0/+28
| | | | copyrighter.pl whilst we're at it
* Reference Matrix Home Servermatrix.org2014-08-122-0/+95