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
8558e1ec
Commit
8558e1ec
authored
9 years ago
by
Erik Johnston
Browse files
Options
Downloads
Patches
Plain Diff
Make get_max_token into inlineCallbacks so that the lock works.
parent
56f518d2
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/storage/util/id_generators.py
+4
-3
4 additions, 3 deletions
synapse/storage/util/id_generators.py
with
4 additions
and
3 deletions
synapse/storage/util/id_generators.py
+
4
−
3
View file @
8558e1ec
...
...
@@ -105,21 +105,22 @@ class StreamIdGenerator(object):
return
manager
()
@defer.inlineCallbacks
def
get_max_token
(
self
,
store
):
"""
Returns the maximum stream id such that all stream ids less than or
equal to it have been successfully persisted.
"""
with
self
.
_lock
:
if
self
.
_unfinished_ids
:
return
self
.
_unfinished_ids
[
0
]
-
1
defer
.
returnValue
(
self
.
_unfinished_ids
[
0
]
-
1
)
if
not
self
.
_current_max
:
return
store
.
runInteraction
(
yield
store
.
runInteraction
(
"
_compute_current_max
"
,
self
.
_compute_current_max
,
)
return
self
.
_current_max
defer
.
returnValue
(
self
.
_current_max
)
def
_compute_current_max
(
self
,
txn
):
txn
.
execute
(
"
SELECT MAX(stream_ordering) FROM events
"
)
...
...
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