summary refs log tree commit diff
path: root/synapse/rest (unfollow)
Commit message (Collapse)AuthorFilesLines
2018-05-09Fix up commentErik Johnston1-1/+1
2018-05-09Update commentsErik Johnston1-5/+6
2018-05-09Refactor get_recent_events_for_room return typeErik Johnston3-7/+21
There is no reason to return a tuple of tokens when the last token is always the token passed as an argument. Changing it makes it consistent with other storage APIs
2018-05-09Refactor pagination DB API to return concrete typeErik Johnston1-28/+48
This makes it easier to document what is being returned by the storage functions and what some functions expect as arguments.
2018-05-09Remove unused from_token paramErik Johnston1-7/+4
2018-05-09Refactor recent events func to use pagination funcErik Johnston1-48/+27
This also removes a cache that is unlikely to ever get hit.
2018-05-09Fix up comments and make function privateErik Johnston1-7/+7
2018-05-09nuke-room-from-db.sh: nuke from table event_search toorubo771-0/+1
2018-05-09Dont nuke non-existing table event_search_contentrubo771-1/+0
2018-05-09nuke-room-from-db.sh: added postgresql option and helprubo771-1/+11
2018-05-08Reuse existing pagination code for context APIErik Johnston1-75/+15
2018-05-08Parse tokens before calling DB functionErik Johnston1-14/+18
2018-05-08Only fetch required fields from databaseErik Johnston1-1/+2
2018-05-08Split paginate_room_events storage functionErik Johnston1-28/+72
2018-05-05notifications: Convert next_token to string according to the specKonstantinos Sideris1-1/+1
Currently the parameter is serialized as an integer. Signed-off-by: Konstantinos Sideris <sideris.konstantin@gmail.com>
2018-05-03Note that label values can be anythingErik Johnston1-1/+2
2018-05-03Fix metrics that have integer value labelsErik Johnston1-1/+1
2018-05-03Fix logcontext leaks in rate limiterRichard van der Hoff1-3/+14
2018-05-03Don't abortConnection() if the transport connection has already closed.Will Hunt1-3/+8
2018-05-03Fix changes warningRichard van der Hoff1-2/+2
2018-05-03Warn of potential client incompatibility from #3161Richard van der Hoff1-0/+15
2018-05-03Fix up grammarErik Johnston1-3/+3
2018-05-02add missing param to cancelled_to_request_timed_out_errorRichard van der Hoff1-1/+1
This gets two arguments, not one.
2018-05-02Make _escape_character take MatchObjectErik Johnston1-2/+10
2018-05-02Escape label values in prometheus metricsErik Johnston2-3/+40
2018-05-02Fix logcontext leak in media repoRichard van der Hoff2-1/+4
Make FileResponder.write_to_consumer uphold the logcontext contract
2018-05-02Remove spurious unittest.DEBUGRichard van der Hoff1-1/+0
2018-05-02Fix a couple of logcontext leaks in unit testsRichard van der Hoff2-3/+9
... which were making other, innocent, tests, fail. Plus remove a spurious unittest.DEBUG which was making the output noisy.
2018-05-02Fix a class of logcontext leaksRichard van der Hoff2-33/+94
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`.
2018-05-02Fix incorrect reference to StringIORichard van der Hoff2-1/+39
This was introduced in 4f2f5171
2018-05-01missing word :|Matthew Hodgson1-1/+1
2018-05-01fix markdownMatthew Hodgson1-3/+3
2018-05-01changelog for 0.28.1 v0.28.1Matthew Hodgson1-2/+23
2018-05-01Update __init__.pyNeil Johnson1-1/+1
bump version
2018-05-01Miscellaneous fixes to python_dependenciesRichard van der Hoff1-1/+19
* add some doc about wtf this thing does * pin Twisted to < 18.4 * add explicit dep on six (fixes #3089)
2018-05-01Apply some limits to depth to counter abuseRichard van der Hoff3-4/+26
* When creating a new event, cap its depth to 2^63 - 1 * When receiving events, reject any without a sensible depth As per https://docs.google.com/document/d/1I3fi2S-XnpO45qrpCsowZv8P8dHcNZ4fsBsbOW7KABI
2018-04-30Burminate v1authAdrian Tschira7-25/+24
This closes #2602 v1auth was created to account for the differences in status code between the v1 and v2_alpha revisions of the protocol (401 vs 403 for invalid tokens). However since those protocols were merged, this makes the r0 version/endpoint internally inconsistent, and violates the specification for the r0 endpoint. This might break clients that rely on this inconsistency with the specification. This is said to affect the legacy angular reference client. However, I feel that restoring parity with the spec is more important. Either way, it is critical to inform developers about this change, in case they rely on the illegal behaviour. Signed-off-by: Adrian Tschira <nota@notafile.com>
2018-04-30Fixes #3135 - Replace _OpenSSLECCurve with crypto.get_elliptic_curve (#3157)Will Hunt2-8/+8
fixes #3135 Signed-off-by: Will Hunt will@half-shot.uk
2018-04-30add guard for None on purge_history apiKrombel1-1/+14
2018-04-30run config tests on py3Adrian Tschira1-1/+2
Signed-off-by: Adrian Tschira <nota@notafile.com>
2018-04-30add comment explaining attributeerrorAdrian Tschira1-0/+3
2018-04-30add py36 to build matrixRichard van der Hoff1-5/+13
2018-04-30Remove redundant call to preserve_fnRichard van der Hoff1-4/+2
submit_event_for_as doesn't return a deferred anyway, so this is pointless.
2018-04-30Update tox.iniRichard van der Hoff1-1/+1
add missing comma
2018-04-29Construct HMAC as bytes on py3Adrian Tschira2-11/+15
Signed-off-by: Adrian Tschira <nota@notafile.com>
2018-04-29more bytes stringsAdrian Tschira4-7/+10
Signed-off-by: Adrian Tschira <nota@notafile.com>
2018-04-28fix missing importMatthew Hodgson1-0/+1
2018-04-28pep8Matthew Hodgson1-3/+5
2018-04-28make it work with sqliteMatthew Hodgson2-34/+54
2018-04-28Move more xrange to sixAdrian Tschira9-11/+28
plus a bonus next() Signed-off-by: Adrian Tschira <nota@notafile.com>
2018-04-28replace stringIO importsAdrian Tschira2-3/+3
2018-04-28move httplib import to sixAdrian Tschira1-3/+3
2018-04-28make imports localAdrian Tschira4-7/+7
Signed-off-by: Adrian Tschira <nota@notafile.com>
2018-04-28Don't yield in list comprehensionsAdrian Tschira1-5/+9
I've tried to grep for more of this with no success. Signed-off-by: Adrian Tschira <nota@notafile.com>
2018-04-28open log_config in text mode tooAdrian Tschira1-1/+1
Signed-off-by: Adrian Tschira <nota@notafile.com>
2018-04-27Add py3 tests to tox with folders that workAdrian Tschira1-1/+9
It's just a few tests, but it will at least prevent a few files from regressing. Also, it makes it easiert to check your code against py36 while writing it. Signed-off-by: Adrian Tschira <nota@notafile.com>
2018-04-27pep8; remove spurious importRichard van der Hoff1-1/+1
2018-04-27Use run_in_background in preference to preserve_fnRichard van der Hoff22-71/+97
While I was going through uses of preserve_fn for other PRs, I converted places which only use the wrapped function once to use run_in_background, to avoid creating the function object.
2018-04-27Backport deferred.addTimeoutRichard van der Hoff5-14/+90
Twisted 16.0 doesn't have addTimeout, so let's backport it.
2018-04-27Trap exceptions thrown within run_in_backgroundRichard van der Hoff1-1/+7
Turn any exceptions that get thrown synchronously within run_in_background into Failures instead.
2018-04-27Update CHANGES.rstNeil Johnson1-1/+1
2018-04-27Update CHANGES.rstNeil Johnson1-1/+1
2018-04-27reraise exceptions more carefullyRichard van der Hoff2-13/+24
We need to be careful (under python 2, at least) that when we reraise an exception after doing some error handling, we actually reraise the original exception rather than anything that might have been raised (and handled) during the error handling.
2018-04-27Refactor event storage to not require stateErik Johnston1-37/+67
This is in preparation for using contexts that may or may not have the current_state_ids set. This will allow us to avoid unnecessarily pulling out state for an event on the master process when using workers. We also add a check to see if the state groups of the old extremities are the same as the new ones.
2018-04-27Add missing consumeErrorsRichard van der Hoff3-5/+9
In general we want defer.gatherResults to consumeErrors, rather than having exceptions hanging around and getting logged as CRITICAL unhandled errors.
2018-04-27Improve exception handling for background processesRichard van der Hoff20-237/+335
There were a bunch of places where we fire off a process to happen in the background, but don't have any exception handling on it - instead relying on the unhandled error being logged when the relevent deferred gets garbage-collected. This is unsatisfactory for a number of reasons: - logging on garbage collection is best-effort and may happen some time after the error, if at all - it can be hard to figure out where the error actually happened. - it is logged as a scary CRITICAL error which (a) I always forget to grep for and (b) it's not really CRITICAL if a background process we don't care about fails. So this is an attempt to add exception handling to everything we fire off into the background.
2018-04-27also upgrade pip when installingRichard van der Hoff1-0/+4
2018-04-26