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
a9631812
Commit
a9631812
authored
5 years ago
by
Richard van der Hoff
Browse files
Options
Downloads
Patches
Plain Diff
Update comments and docstring
parent
4fb3c129
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/metrics/background_process_metrics.py
+6
-4
6 additions, 4 deletions
synapse/metrics/background_process_metrics.py
with
6 additions
and
4 deletions
synapse/metrics/background_process_metrics.py
+
6
−
4
View file @
a9631812
...
@@ -175,7 +175,7 @@ def run_as_background_process(desc, func, *args, **kwargs):
...
@@ -175,7 +175,7 @@ def run_as_background_process(desc, func, *args, **kwargs):
Args:
Args:
desc (str): a description for this background process type
desc (str): a description for this background process type
func: a function, which may return a Deferred
func: a function, which may return a Deferred
or a coroutine
args: positional args for func
args: positional args for func
kwargs: keyword args for func
kwargs: keyword args for func
...
@@ -199,11 +199,13 @@ def run_as_background_process(desc, func, *args, **kwargs):
...
@@ -199,11 +199,13 @@ def run_as_background_process(desc, func, *args, **kwargs):
_background_processes
.
setdefault
(
desc
,
set
()).
add
(
proc
)
_background_processes
.
setdefault
(
desc
,
set
()).
add
(
proc
)
try
:
try
:
# We ensureDeferred here to handle coroutines
result
=
func
(
*
args
,
**
kwargs
)
result
=
func
(
*
args
,
**
kwargs
)
# We need this check because ensureDeferred doesn't like when
# We probably don't have an ensureDeferred in our call stack to handle
# func doesn't return a Deferred or coroutine.
# coroutine results, so we need to ensureDeferred here.
#
# But we need this check because ensureDeferred doesn't like being
# called on immediate values (as opposed to Deferreds or coroutines).
if
iscoroutine
(
result
):
if
iscoroutine
(
result
):
result
=
defer
.
ensureDeferred
(
result
)
result
=
defer
.
ensureDeferred
(
result
)
...
...
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