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
Container Registry
Model registry
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
Maunium
synapse
Commits
54d50fbf
Commit
54d50fbf
authored
5 years ago
by
Erik Johnston
Browse files
Options
Downloads
Patches
Plain Diff
Get events all at once
parent
e9e5d339
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/stats.py
+26
-33
26 additions, 33 deletions
synapse/storage/stats.py
with
26 additions
and
33 deletions
synapse/storage/stats.py
+
26
−
33
View file @
54d50fbf
...
...
@@ -179,46 +179,39 @@ class StatsStore(StateDeltasStore):
current_state_ids
=
yield
self
.
get_current_state_ids
(
room_id
)
join_rules
=
yield
self
.
get_event
(
current_state_ids
.
get
((
EventTypes
.
JoinRules
,
""
)),
allow_none
=
True
join_rules_id
=
current_state_ids
.
get
((
EventTypes
.
JoinRules
,
""
))
history_visibility_id
=
current_state_ids
.
get
(
(
EventTypes
.
RoomHistoryVisibility
,
""
)
)
history_visibility
=
yield
self
.
get_event
(
current_state_ids
.
get
((
EventTypes
.
RoomHistoryVisibility
,
""
)),
allow_none
=
True
,
)
encryption
=
yield
self
.
get_event
(
current_state_ids
.
get
((
EventTypes
.
RoomEncryption
,
""
)),
allow_none
=
True
)
name
=
yield
self
.
get_event
(
current_state_ids
.
get
((
EventTypes
.
Name
,
""
)),
allow_none
=
True
)
topic
=
yield
self
.
get_event
(
current_state_ids
.
get
((
EventTypes
.
Topic
,
""
)),
allow_none
=
True
)
avatar
=
yield
self
.
get_event
(
current_state_ids
.
get
((
EventTypes
.
RoomAvatar
,
""
)),
allow_none
=
True
)
canonical_alias
=
yield
self
.
get_event
(
current_state_ids
.
get
((
EventTypes
.
CanonicalAlias
,
""
)),
allow_none
=
True
)
def
_or_none
(
x
,
arg
):
if
x
:
return
x
.
content
.
get
(
arg
)
encryption_id
=
current_state_ids
.
get
((
EventTypes
.
RoomEncryption
,
""
))
name_id
=
current_state_ids
.
get
((
EventTypes
.
Name
,
""
))
topic_id
=
current_state_ids
.
get
((
EventTypes
.
Topic
,
""
))
avatar_id
=
current_state_ids
.
get
((
EventTypes
.
RoomAvatar
,
""
))
canonical_alias_id
=
current_state_ids
.
get
((
EventTypes
.
CanonicalAlias
,
""
))
state_events
=
yield
self
.
get_events
([
join_rules_id
,
history_visibility_id
,
encryption_id
,
name_id
,
topic_id
,
avatar_id
,
canonical_alias_id
,
])
def
_get_or_none
(
event_id
,
arg
):
event
=
state_events
.
get
(
event_id
)
if
event
:
return
event
.
content
.
get
(
arg
)
return
None
yield
self
.
update_room_state
(
room_id
,
{
"
join_rules
"
:
_or_none
(
join_rules
,
"
join_rule
"
),
"
history_visibility
"
:
_or_none
(
history_visibility
,
"
history_visibility
"
"
join_rules
"
:
_get
_or_none
(
join_rules
_id
,
"
join_rule
"
),
"
history_visibility
"
:
_get
_or_none
(
history_visibility
_id
,
"
history_visibility
"
),
"
encryption
"
:
_or_none
(
encryption
,
"
algorithm
"
),
"
name
"
:
_or_none
(
name
,
"
name
"
),
"
topic
"
:
_or_none
(
topic
,
"
topic
"
),
"
avatar
"
:
_or_none
(
avatar
,
"
url
"
),
"
canonical_alias
"
:
_or_none
(
canonical_alias
,
"
alias
"
),
"
encryption
"
:
_get
_or_none
(
encryption
_id
,
"
algorithm
"
),
"
name
"
:
_get
_or_none
(
name
_id
,
"
name
"
),
"
topic
"
:
_get
_or_none
(
topic
_id
,
"
topic
"
),
"
avatar
"
:
_get
_or_none
(
avatar
_id
,
"
url
"
),
"
canonical_alias
"
:
_get
_or_none
(
canonical_alias
_id
,
"
alias
"
),
},
)
...
...
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