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
2135c198
Commit
2135c198
authored
5 years ago
by
Erik Johnston
Browse files
Options
Downloads
Patches
Plain Diff
Add has_completed_background_update
This allows checking if a specific background update has completed.
parent
367158a6
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/background_updates.py
+24
-1
24 additions, 1 deletion
synapse/storage/background_updates.py
with
24 additions
and
1 deletion
synapse/storage/background_updates.py
+
24
−
1
View file @
2135c198
...
...
@@ -140,7 +140,7 @@ class BackgroundUpdateStore(SQLBaseStore):
"
background_updates
"
,
keyvalues
=
None
,
retcol
=
"
1
"
,
desc
=
"
check
_background_updates
"
,
desc
=
"
has_completed
_background_updates
"
,
)
if
not
updates
:
self
.
_all_done
=
True
...
...
@@ -148,6 +148,29 @@ class BackgroundUpdateStore(SQLBaseStore):
return
False
async
def
has_completed_background_update
(
self
,
update_name
):
"""
Check if the given background update has finished running.
Returns:
Deferred[bool]
"""
if
self
.
_all_done
:
return
True
if
update_name
in
self
.
_background_update_queue
:
return
False
update_exists
=
await
self
.
_simple_select_one_onecol
(
"
background_updates
"
,
keyvalues
=
{
"
update_name
"
:
update_name
},
retcol
=
"
1
"
,
desc
=
"
has_completed_background_update
"
,
allow_none
=
True
,
)
return
not
update_exists
@defer.inlineCallbacks
def
do_next_background_update
(
self
,
desired_duration_ms
):
"""
Does some amount of work on the next queued background update
...
...
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