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
06a14876
Commit
06a14876
authored
7 years ago
by
Richard van der Hoff
Browse files
Options
Downloads
Patches
Plain Diff
Add find_first_stream_ordering_after_ts
Expose this as a public function which can be called outside a txn
parent
9e08a93a
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/event_push_actions.py
+21
-0
21 additions, 0 deletions
synapse/storage/event_push_actions.py
with
21 additions
and
0 deletions
synapse/storage/event_push_actions.py
+
21
−
0
View file @
06a14876
...
...
@@ -489,6 +489,27 @@ class EventPushActionsWorkerStore(SQLBaseStore):
self
.
stream_ordering_day_ago
)
def
find_first_stream_ordering_after_ts
(
self
,
ts
):
"""
Gets the stream ordering corresponding to a given timestamp.
Specifically, finds the stream_ordering of the first event that was
received after the timestamp. This is done by a binary search on the
events table, since there is no index on received_ts, so is
relatively slow.
Args:
ts (int): timestamp in millis
Returns:
Deferred[int]: stream ordering of the first event received after
the timestamp
"""
return
self
.
runInteraction
(
"
_find_first_stream_ordering_after_ts_txn
"
,
self
.
_find_first_stream_ordering_after_ts_txn
,
ts
,
)
def
_find_first_stream_ordering_after_ts_txn
(
self
,
txn
,
ts
):
"""
Find the stream_ordering of the first event that was received after
...
...
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