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
23c639ff
Commit
23c639ff
authored
9 years ago
by
Erik Johnston
Browse files
Options
Downloads
Patches
Plain Diff
Split a storage function in two so that we don't have to do extra work.
parent
8be5284e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
synapse/federation/federation_server.py
+2
-2
2 additions, 2 deletions
synapse/federation/federation_server.py
synapse/state.py
+1
-6
1 addition, 6 deletions
synapse/state.py
synapse/storage/event_federation.py
+11
-0
11 additions, 0 deletions
synapse/storage/event_federation.py
with
14 additions
and
8 deletions
synapse/federation/federation_server.py
+
2
−
2
View file @
23c639ff
...
...
@@ -417,13 +417,13 @@ class FederationServer(FederationBase):
pdu
.
internal_metadata
.
outlier
=
True
elif
min_depth
and
pdu
.
depth
>
min_depth
:
if
get_missing
and
prevs
-
seen
:
latest
_tuples
=
yield
self
.
store
.
get_latest_events_in_room
(
latest
=
yield
self
.
store
.
get_latest_event
_id
s_in_room
(
pdu
.
room_id
)
# We add the prev events that we have seen to the latest
# list to ensure the remote server doesn't give them to us
latest
=
set
(
e_id
for
e_id
,
_
,
_
in
latest_tuples
)
latest
=
set
(
latest
)
latest
|=
seen
missing_events
=
yield
self
.
get_missing_events
(
...
...
This diff is collapsed.
Click to expand it.
synapse/state.py
+
1
−
6
View file @
23c639ff
...
...
@@ -86,12 +86,7 @@ class StateHandler(object):
If `event_type` is specified, then the method returns only the one
event (or None) with that `event_type` and `state_key`.
"""
events
=
yield
self
.
store
.
get_latest_events_in_room
(
room_id
)
event_ids
=
[
e_id
for
e_id
,
_
,
_
in
events
]
event_ids
=
yield
self
.
store
.
get_latest_event_ids_in_room
(
room_id
)
cache
=
None
if
self
.
_state_cache
is
not
None
:
...
...
This diff is collapsed.
Click to expand it.
synapse/storage/event_federation.py
+
11
−
0
View file @
23c639ff
...
...
@@ -96,11 +96,22 @@ class EventFederationStore(SQLBaseStore):
room_id
,
)
def
get_latest_event_ids_in_room
(
self
,
room_id
):
return
self
.
_simple_select_onecol
(
table
=
"
event_forward_extremities
"
,
keyvalues
=
{
"
room_id
"
:
room_id
,
},
retcol
=
"
event_id
"
,
desc
=
"
get_latest_events_in_room
"
,
)
def
_get_latest_events_in_room
(
self
,
txn
,
room_id
):
sql
=
(
"
SELECT e.event_id, e.depth FROM events as e
"
"
INNER JOIN event_forward_extremities as f
"
"
ON e.event_id = f.event_id
"
"
AND e.room_id = f.room_id
"
"
WHERE f.room_id = ?
"
)
...
...
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