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
Container registry
Model registry
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
Maunium
synapse
Commits
b2cd6acc
Commit
b2cd6acc
authored
7 years ago
by
Richard van der Hoff
Browse files
Options
Downloads
Patches
Plain Diff
Remove __PreservingContextDeferred too
parent
7e6fa29c
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
synapse/util/logcontext.py
+0
-30
0 additions, 30 deletions
synapse/util/logcontext.py
with
0 additions
and
30 deletions
synapse/util/logcontext.py
+
0
−
30
View file @
b2cd6acc
...
...
@@ -261,36 +261,6 @@ class PreserveLoggingContext(object):
)
class
_PreservingContextDeferred
(
defer
.
Deferred
):
"""
A deferred that ensures that all callbacks and errbacks are called with
the given logging context.
"""
def
__init__
(
self
,
context
):
self
.
_log_context
=
context
defer
.
Deferred
.
__init__
(
self
)
def
addCallbacks
(
self
,
callback
,
errback
=
None
,
callbackArgs
=
None
,
callbackKeywords
=
None
,
errbackArgs
=
None
,
errbackKeywords
=
None
):
callback
=
self
.
_wrap_callback
(
callback
)
errback
=
self
.
_wrap_callback
(
errback
)
return
defer
.
Deferred
.
addCallbacks
(
self
,
callback
,
errback
=
errback
,
callbackArgs
=
callbackArgs
,
callbackKeywords
=
callbackKeywords
,
errbackArgs
=
errbackArgs
,
errbackKeywords
=
errbackKeywords
,
)
def
_wrap_callback
(
self
,
f
):
def
g
(
res
,
*
args
,
**
kwargs
):
with
PreserveLoggingContext
(
self
.
_log_context
):
res
=
f
(
res
,
*
args
,
**
kwargs
)
return
res
return
g
def
preserve_fn
(
f
):
"""
Wraps a function, to ensure that the current context is restored after
return from the function, and that the sentinel context is set once the
...
...
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