Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Matrix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Operate
Environments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Matrix
Commits
359c97f5
Commit
359c97f5
authored
8 years ago
by
Erik Johnston
Committed by
GitHub
8 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #1913 from matrix-org/kegan/dont-cache-errors
http txns: Do not cache error responses
parents
6bba8024
d0497425
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
synapse/rest/client/transactions.py
+11
-3
11 additions, 3 deletions
synapse/rest/client/transactions.py
with
11 additions
and
3 deletions
synapse/rest/client/transactions.py
+
11
−
3
View file @
359c97f5
...
...
@@ -87,9 +87,17 @@ class HttpTransactionCache(object):
deferred
=
fn
(
*
args
,
**
kwargs
)
# We don't add an errback to the raw deferred, so we ask ObservableDeferred
# to swallow the error. This is fine as the error will still be reported
# to the observers.
# if the request fails with a Twisted failure, remove it
# from the transaction map. This is done to ensure that we don't
# cache transient errors like rate-limiting errors, etc.
def
remove_from_map
(
err
):
self
.
transactions
.
pop
(
txn_key
,
None
)
return
err
deferred
.
addErrback
(
remove_from_map
)
# We don't add any other errbacks to the raw deferred, so we ask
# ObservableDeferred to swallow the error. This is fine as the error will
# still be reported to the observers.
observable
=
ObservableDeferred
(
deferred
,
consumeErrors
=
True
)
self
.
transactions
[
txn_key
]
=
(
observable
,
self
.
clock
.
time_msec
())
return
observable
.
observe
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment