Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Timo Ley
synapse
Commits
62126c99
Commit
62126c99
authored
9 years ago
by
Erik Johnston
Browse files
Options
Downloads
Patches
Plain Diff
Propogate stale cache errors to calling functions
parent
63b1eaf3
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
synapse/storage/_base.py
+4
-3
4 additions, 3 deletions
synapse/storage/_base.py
with
4 additions
and
3 deletions
synapse/storage/_base.py
+
4
−
3
View file @
62126c99
...
@@ -183,8 +183,8 @@ class CacheDescriptor(object):
...
@@ -183,8 +183,8 @@ class CacheDescriptor(object):
try
:
try
:
cached_result_d
=
cache
.
get
(
*
keyargs
)
cached_result_d
=
cache
.
get
(
*
keyargs
)
observed
=
cached_result_d
.
observe
()
if
DEBUG_CACHES
:
if
DEBUG_CACHES
:
@defer.inlineCallbacks
@defer.inlineCallbacks
def
check_result
(
cached_result
):
def
check_result
(
cached_result
):
actual_result
=
yield
self
.
function_to_call
(
obj
,
*
args
,
**
kwargs
)
actual_result
=
yield
self
.
function_to_call
(
obj
,
*
args
,
**
kwargs
)
...
@@ -195,9 +195,10 @@ class CacheDescriptor(object):
...
@@ -195,9 +195,10 @@ class CacheDescriptor(object):
cached_result
,
actual_result
,
cached_result
,
actual_result
,
)
)
raise
ValueError
(
"
Stale cache entry
"
)
raise
ValueError
(
"
Stale cache entry
"
)
cached_result_d
.
observe
().
addCallback
(
check_result
)
defer
.
returnValue
(
cached_result
)
observed
.
addCallback
(
check_result
)
return
cached_result_d
.
observe
()
return
observe
d
except
KeyError
:
except
KeyError
:
# Get the sequence number of the cache before reading from the
# Get the sequence number of the cache before reading from the
# database so that we can tell if the cache is invalidated
# database so that we can tell if the cache is invalidated
...
...
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