Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | Merge pull request #6505 from matrix-org/erikj/make_deferred_yiedable | Erik Johnston | 2019-12-10 | 1 | -0/+24 |
|\ | | | | | Fix `make_deferred_yieldable` to work with coroutines | ||||
| * | Fix make_deferred_yieldable to work with coroutines | Erik Johnston | 2019-12-10 | 1 | -0/+24 |
| | | |||||
* | | Remove SnapshotCache in favour of ResponseCache | Erik Johnston | 2019-12-09 | 1 | -63/+0 |
|/ | |||||
* | Make ObservableDeferred.observe() always return deferred. | Erik Johnston | 2019-10-30 | 1 | -2/+2 |
| | | | | | | | This makes it easier to use in an async/await world. Also fixes a bug where cache descriptors would occaisonally return a raw value rather than a deferred. | ||||
* | Quick fix to ensure cache descriptors always return deferreds | Erik Johnston | 2019-10-28 | 1 | -2/+2 |
| | |||||
* | Add 'failure_ts' column to 'destinations' table (#6016) | Richard van der Hoff | 2019-09-17 | 1 | -0/+127 |
| | | | | Track the time that a server started failing at, for general analysis purposes. | ||||
* | Retry well-known lookup before expiry. | Erik Johnston | 2019-08-13 | 1 | -2/+2 |
| | | | | | | | | | This gives a bit of a grace period where we can attempt to refetch a remote `well-known`, while still using the cached result if that fails. Hopefully this will make the well-known resolution a bit more torelant of failures, rather than it immediately treating failures as "no result" and caching that for an hour. | ||||
* | Fix some error cases in the caching layer. (#5749) | Richard van der Hoff | 2019-07-25 | 1 | -3/+87 |
| | | | | | | | There was some inconsistent behaviour in the caching layer around how exceptions were handled - particularly synchronously-thrown ones. This seems to be most easily handled by pushing the creation of ObservableDeferreds down from CacheDescriptor to the Cache. | ||||
* | Replace returnValue with return (#5736) | Amber Brown | 2019-07-23 | 1 | -4/+4 |
| | |||||
* | Fixes to the federation rate limiter (#5621) | Richard van der Hoff | 2019-07-05 | 1 | -0/+97 |
| | | | | | | | - Put the default window_size back to 1000ms (broken by #5181) - Make the `rc_federation` config actually do something - fix an off-by-one error in the 'concurrent' limit - Avoid creating an unused `_PerHostRatelimiter` object for every single incoming request | ||||
* | Move logging utilities out of the side drawer of util/ and into logging/ (#5606) | Amber Brown | 2019-07-04 | 5 | -47/+44 |
| | |||||
* | Fix media repo breaking (#5593) | Amber Brown | 2019-07-02 | 1 | -12/+21 |
| | |||||
* | Run Black. (#5482) | Amber Brown | 2019-06-20 | 2 | -53/+53 |
| | |||||
* | Run Black on the tests again (#5170) | Amber Brown | 2019-05-10 | 1 | -12/+11 |
| | |||||
* | Remove periods from copyright headers (#5046) | Andrew Morgan | 2019-04-11 | 1 | -1/+1 |
| | |||||
* | Add a caching layer to .well-known responses (#4516) | Richard van der Hoff | 2019-01-30 | 1 | -0/+83 |
| | |||||
* | Fix incorrect logcontexts after a Deferred was cancelled (#4407) | Richard van der Hoff | 2019-01-17 | 1 | -0/+104 |
| | |||||
* | Include eventid in log lines when processing incoming federation ↵ | Richard van der Hoff | 2018-09-27 | 1 | -0/+5 |
| | | | | | | | | | | | transactions (#3959) when processing incoming transactions, it can be hard to see what's going on, because we process a bunch of stuff in parallel, and because we may end up recursively working our way through a chain of three or four events. This commit creates a way to use logcontexts to add the relevant event ids to the log lines. | ||||
* | Fix some instances of ExpiringCache not expiring cache items | Erik Johnston | 2018-09-21 | 1 | -1/+0 |
| | | | | | | | | ExpiringCache required that `start()` be called before it would actually start expiring entries. A number of places didn't do that. This PR removes `start` from ExpiringCache, and automatically starts backround reaping process on creation instead. | ||||
* | Run black. | black | 2018-08-10 | 10 | -76/+41 |
| | |||||
* | Rename async to async_helpers because `async` is a keyword on Python 3.7 (#3678) | Amber Brown | 2018-08-10 | 2 | -2/+2 |
| | |||||
* | fix invalidation | Richard van der Hoff | 2018-07-27 | 1 | -1/+41 |
| | |||||
* | Rewrite cache list decorator | Richard van der Hoff | 2018-07-27 | 1 | -0/+61 |
| | | | | | Because it was complicated and annoyed me. I suspect this will be more efficient too. | ||||
* | Test and fix support for cancellation in Linearizer | Richard van der Hoff | 2018-07-20 | 1 | -0/+31 |
| | |||||
* | Combine Limiter and Linearizer | Richard van der Hoff | 2018-07-20 | 2 | -70/+47 |
| | | | | | Linearizer was effectively a Limiter with max_count=1, so rather than maintaining two sets of code, let's combine them. | ||||
* | Add a sleep to the Limiter to fix stack overflows. | Richard van der Hoff | 2018-07-20 | 1 | -4/+4 |
| | | | | Fixes #3570 | ||||
* | Add unit test | Erik Johnston | 2018-07-17 | 1 | -0/+16 |
| | |||||
* | Fixup unit test | Erik Johnston | 2018-07-13 | 1 | -3/+3 |
| | |||||
* | run isort | Amber Brown | 2018-07-09 | 14 | -30/+38 |
| | |||||
* | Reinstate lost run_on_reactor in unit test | Richard van der Hoff | 2018-07-04 | 1 | -2/+15 |
| | | | | | | | | a61738b removed a call to run_on_reactor from a unit test, but that call was doing something useful, in making the function in question asynchronous. Reinstate the call and add a check that we are testing what we wanted to be testing. | ||||
* | Disable partial state group caching for wildcard lookups | Richard van der Hoff | 2018-06-22 | 1 | -6/+6 |
| | | | | | | | When _get_state_for_groups is given a wildcard filter, just do a complete lookup. Hopefully this will give us the best of both worlds by not filling up the ram if we only need one or two keys, but also making the cache still work for the federation reader usecase. | ||||
* | Pass around the reactor explicitly (#3385) | Amber Brown | 2018-06-22 | 3 | -11/+13 |
| | |||||
* | Remove run_on_reactor (#3395) | Amber Brown | 2018-06-14 | 1 | -2/+0 |
| | |||||
* | Port to sortedcontainers (with tests!) (#3332) | Amber Brown | 2018-06-06 | 1 | -0/+198 |
| | |||||
* | fix another dumb typo | Matthew Hodgson | 2018-05-29 | 1 | -2/+2 |
| | |||||
* | Merge branch 'develop' into rav/more_logcontext_leaks | Richard van der Hoff | 2018-05-02 | 1 | -0/+38 |
|\ | |||||
| * | Fix incorrect reference to StringIO | Richard van der Hoff | 2018-05-02 | 1 | -0/+38 |
| | | | | | | | | This was introduced in 4f2f5171 | ||||
* | | Remove spurious unittest.DEBUG | Richard van der Hoff | 2018-05-02 | 1 | -1/+0 |
| | | |||||
* | | Fix a class of logcontext leaks | Richard van der Hoff | 2018-05-02 | 1 | -11/+56 |
|/ | | | | | | | | | | | | | | | | So, it turns out that if you have a first `Deferred` `D1`, you can add a callback which returns another `Deferred` `D2`, and `D2` must then complete before any further callbacks on `D1` will execute (and later callbacks on `D1` get the *result* of `D2` rather than `D2` itself). So, `D1` might have `called=True` (as in, it has started running its callbacks), but any new callbacks added to `D1` won't get run until `D2` completes - so if you `yield D1` in an `inlineCallbacks` function, your `yield` will 'block'. In conclusion: some of our assumptions in `logcontext` were invalid. We need to make sure that we don't optimise out the logcontext juggling when this situation happens. Fortunately, it is easy to detect by checking `D1.paused`. | ||||
* | Merge branch 'develop' into rav/deferred_timeout | Richard van der Hoff | 2018-04-27 | 2 | -2/+3 |
|\ | |||||
| * | Make tests py3 compatible | Adrian Tschira | 2018-04-16 | 2 | -2/+3 |
| | | | | | | | | | | | | | | | | | | | | | | This is a mixed commit that fixes various small issues * print parentheses * 01 is invalid syntax (it was octal in py2) * [x for i in 1, 2] is invalid syntax * six moves Signed-off-by: Adrian Tschira <nota@notafile.com> | ||||
* | | Use deferred.addTimeout instead of time_bound_deferred | Richard van der Hoff | 2018-04-23 | 1 | -33/+0 |
|/ | | | | This doesn't feel like a wheel we need to reinvent. | ||||
* | Fix overzealous cache invalidation | Richard van der Hoff | 2018-04-05 | 1 | -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_consumer | Erik Johnston | 2018-01-18 | 1 | -0/+176 |
|\ | | | | | Add decent impl of a FileConsumer | ||||
| * | Move test stuff to tests | Erik Johnston | 2018-01-18 | 1 | -8/+46 |
| | | |||||
| * | Add decent impl of a FileConsumer | Erik Johnston | 2018-01-17 | 1 | -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 copying | Richard van der Hoff | 2018-01-16 | 1 | -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_logcontext | Richard van der Hoff | 2017-10-17 | 1 | -0/+0 |
| | | | | The file under test is logcontext.py, not log_context.py | ||||
* | Add some tests for make_deferred_yieldable | Richard van der Hoff | 2017-10-17 | 1 | -0/+38 |
| | |||||
* | Fix stackoverflow and logcontexts from linearizer | Richard van der Hoff | 2017-10-11 | 1 | -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 Johnston | 2017-05-17 | 1 | -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 tests | Erik Johnston | 2017-03-30 | 2 | -1/+41 |
| | |||||
* | Fix the logcontext handling in the cache wrappers (#2077) | Richard van der Hoff | 2017-03-30 | 1 | -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_deferred | Richard van der Hoff | 2017-03-23 | 1 | -0/+33 |
|\ | | | | | Fix time_bound_deferred to throw the right exception | ||||
| * | Fix time_bound_deferred to throw the right exception | Richard van der Hoff | 2017-03-23 | 1 | -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 keys | Richard van der Hoff | 2017-03-22 | 2 | -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 reactor | Richard van der Hoff | 2017-03-18 | 1 | -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 test | Erik Johnston | 2017-01-17 | 1 | -12/+12 |
| | |||||
* | Speed up cache size calculation | Erik Johnston | 2017-01-17 | 1 | -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 tests | Erik Johnston | 2017-01-16 | 1 | -0/+84 |
| | |||||
* | Optionally measure size of cache by sum of length of values | Erik Johnston | 2017-01-13 | 1 | -0/+25 |
| | |||||
* | Add Limiter: limit concurrent access to resource | Erik Johnston | 2016-11-10 | 1 | -0/+70 |
| | |||||
* | Ensure invalidation list does not grow unboundedly | Erik Johnston | 2016-08-19 | 1 | -0/+40 |
| | |||||
* | Add concept of cache contexts | Erik Johnston | 2016-08-19 | 1 | -0/+113 |
| | |||||
* | Add ReadWriteLock | Erik Johnston | 2016-07-05 | 1 | -0/+85 |
| | |||||
* | Deduplicate joins | Erik Johnston | 2016-04-07 | 1 | -0/+44 |
| | |||||
* | Add a test for TreeCache.__contains__ | Mark Haines | 2016-02-22 | 1 | -0/+6 |
| | |||||
* | Fix flake8 warnings for tests | Mark Haines | 2016-02-19 | 4 | -2/+2 |
| | |||||
* | Add wheeltimer impl | Erik Johnston | 2016-02-17 | 1 | -0/+74 |
| | |||||
* | Fix test | Erik Johnston | 2016-02-09 | 1 | -9/+1 |
| | |||||
* | Add tests | Erik Johnston | 2016-01-29 | 2 | -0/+19 |
| | |||||
* | Revert all the bits changing keys of eeverything that used LRUCaches to tuples | David Baker | 2016-01-22 | 1 | -22/+22 |
| | |||||
* | Make LRU cache not default to treecache & add options to use it | David Baker | 2016-01-22 | 1 | -1/+2 |
| | |||||
* | Test treecache directly | David Baker | 2016-01-22 | 1 | -0/+19 |
| | |||||
* | Add tests for treecache directly and test del_multi at the LruCache level too. | David Baker | 2016-01-22 | 1 | -0/+66 |
| | |||||
* | Change LRUCache to be tree-based so we can delete subtrees. | David Baker | 2016-01-21 | 1 | -22/+22 |
| | |||||
* | copyrights | Matthew Hodgson | 2016-01-07 | 4 | -4/+4 |
| | |||||
* | Add a unit test for the snapshot cache | Mark Haines | 2015-12-23 | 1 | -0/+60 |
| | |||||
* | Remove the LockManager class because it wasn't being used | Mark Haines | 2015-11-04 | 1 | -108/+0 |
| | |||||
* | Move all the caches into their own package, synapse.util.caches | Erik Johnston | 2015-08-11 | 2 | -4/+2 |
| | |||||
* | Move DictionaryCache | Erik Johnston | 2015-08-04 | 1 | -1/+1 |
| | |||||
* | Add basic dictionary cache | Erik Johnston | 2015-08-04 | 1 | -0/+101 |
| | |||||
* | Add a lru cache class | Mark Haines | 2015-02-11 | 1 | -0/+56 |
| | |||||
* | Add a request-id to each log line | Mark Haines | 2014-10-30 | 1 | -0/+43 |
| | |||||
* | Have all unit tests import from our own subclass of trial's unittest ↵ | Paul "LeoNerd" Evans | 2014-09-12 | 1 | -2/+2 |
| | | | | TestCase; set up logging in ONE PLACE ONLY | ||||
* | fix the copyright holder from matrix.org to OpenMarket Ltd, as matrix.org ↵ | Matthew Hodgson | 2014-09-03 | 2 | -2/+2 |
| | | | | hasn't been incorporated in time for launch. | ||||
* | add in copyrights to everything, not just the synapse subdir, and add a ↵ | Matthew Hodgson | 2014-08-13 | 2 | -0/+28 |
| | | | | copyrighter.pl whilst we're at it | ||||
* | Reference Matrix Home Server | matrix.org | 2014-08-12 | 2 | -0/+95 |