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
ebc48306
Commit
ebc48306
authored
10 years ago
by
Kegan Dougal
Browse files
Options
Downloads
Patches
Plain Diff
PR tweaks: set earlier on and use 'as json' for compat
parent
806a6c88
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
synapse/storage/appservice.py
+7
-11
7 additions, 11 deletions
synapse/storage/appservice.py
synapse/storage/registration.py
+1
-1
1 addition, 1 deletion
synapse/storage/registration.py
synapse/storage/stream.py
+4
-4
4 additions, 4 deletions
synapse/storage/stream.py
with
12 additions
and
16 deletions
synapse/storage/appservice.py
+
7
−
11
View file @
ebc48306
...
@@ -219,20 +219,17 @@ class ApplicationServiceStore(SQLBaseStore):
...
@@ -219,20 +219,17 @@ class ApplicationServiceStore(SQLBaseStore):
# get all rooms matching the room ID regex.
# get all rooms matching the room ID regex.
room_entries
=
yield
self
.
get_all_rooms
()
# RoomEntry list
room_entries
=
yield
self
.
get_all_rooms
()
# RoomEntry list
matching_room_
id_
list
=
[
matching_room_list
=
set
(
[
r
.
room_id
for
r
in
room_entries
if
r
.
room_id
for
r
in
room_entries
if
service
.
is_interested_in_room
(
r
.
room_id
)
service
.
is_interested_in_room
(
r
.
room_id
)
]
]
)
# resolve room IDs for matching room alias regex.
# resolve room IDs for matching room alias regex.
room_alias_mappings
=
yield
self
.
get_all_associations
()
room_alias_mappings
=
yield
self
.
get_all_associations
()
matching_
alias
_list
=
[
matching_
room
_list
|
=
set
(
[
r
.
room_id
for
r
in
room_alias_mappings
if
r
.
room_id
for
r
in
room_alias_mappings
if
service
.
is_interested_in_alias
(
r
.
room_alias
)
service
.
is_interested_in_alias
(
r
.
room_alias
)
]
])
room_ids_matching_alias_or_id
=
set
(
matching_room_id_list
+
matching_alias_list
)
# get all rooms for every user for this AS. This is scoped to users on
# get all rooms for every user for this AS. This is scoped to users on
# this HS only.
# this HS only.
...
@@ -241,11 +238,10 @@ class ApplicationServiceStore(SQLBaseStore):
...
@@ -241,11 +238,10 @@ class ApplicationServiceStore(SQLBaseStore):
u
[
"
name
"
]
for
u
in
user_list
if
u
[
"
name
"
]
for
u
in
user_list
if
service
.
is_interested_in_user
(
u
[
"
name
"
])
service
.
is_interested_in_user
(
u
[
"
name
"
])
]
]
rooms_for_user_matching_user_id
=
[]
# RoomsForUser list
rooms_for_user_matching_user_id
=
set
()
# RoomsForUser list
for
user_id
in
user_list
:
for
user_id
in
user_list
:
rooms_for_user
=
yield
self
.
get_rooms_for_user
(
user_id
)
rooms_for_user
=
yield
self
.
get_rooms_for_user
(
user_id
)
rooms_for_user_matching_user_id
+=
rooms_for_user
rooms_for_user_matching_user_id
|=
set
(
rooms_for_user
)
rooms_for_user_matching_user_id
=
set
(
rooms_for_user_matching_user_id
)
# make RoomsForUser tuples for room ids and aliases which are not in the
# make RoomsForUser tuples for room ids and aliases which are not in the
# main rooms_for_user_list - e.g. they are rooms which do not have AS
# main rooms_for_user_list - e.g. they are rooms which do not have AS
...
@@ -253,7 +249,7 @@ class ApplicationServiceStore(SQLBaseStore):
...
@@ -253,7 +249,7 @@ class ApplicationServiceStore(SQLBaseStore):
known_room_ids
=
[
r
.
room_id
for
r
in
rooms_for_user_matching_user_id
]
known_room_ids
=
[
r
.
room_id
for
r
in
rooms_for_user_matching_user_id
]
missing_rooms_for_user
=
[
missing_rooms_for_user
=
[
RoomsForUser
(
r
,
service
.
sender
,
"
join
"
)
for
r
in
RoomsForUser
(
r
,
service
.
sender
,
"
join
"
)
for
r
in
room_ids_matching_alias_or_id
if
r
not
in
known_room_ids
matching_room_list
if
r
not
in
known_room_ids
]
]
rooms_for_user_matching_user_id
|=
set
(
missing_rooms_for_user
)
rooms_for_user_matching_user_id
|=
set
(
missing_rooms_for_user
)
...
...
This diff is collapsed.
Click to expand it.
synapse/storage/registration.py
+
1
−
1
View file @
ebc48306
...
@@ -93,7 +93,7 @@ class RegistrationStore(SQLBaseStore):
...
@@ -93,7 +93,7 @@ class RegistrationStore(SQLBaseStore):
)
)
def
get_all_users
(
self
):
def
get_all_users
(
self
):
query
=
(
"
SELECT users.name FROM users
"
)
query
=
"
SELECT users.name FROM users
"
return
self
.
_execute
(
return
self
.
_execute
(
self
.
cursor_to_dict
,
self
.
cursor_to_dict
,
query
query
...
...
This diff is collapsed.
Click to expand it.
synapse/storage/stream.py
+
4
−
4
View file @
ebc48306
...
@@ -43,7 +43,7 @@ from synapse.util.logutils import log_function
...
@@ -43,7 +43,7 @@ from synapse.util.logutils import log_function
from
collections
import
namedtuple
from
collections
import
namedtuple
import
logging
import
logging
import
simplejson
import
simplejson
as
json
logger
=
logging
.
getLogger
(
__name__
)
logger
=
logging
.
getLogger
(
__name__
)
...
@@ -178,7 +178,7 @@ class StreamStore(SQLBaseStore):
...
@@ -178,7 +178,7 @@ class StreamStore(SQLBaseStore):
# interested in was invited to a room. We'll be passing this
# interested in was invited to a room. We'll be passing this
# through _get_events_txn later, so ignore the fact that this
# through _get_events_txn later, so ignore the fact that this
# may be a redacted event.
# may be a redacted event.
event_content
=
simple
json
.
loads
(
row
[
"
unrecognized_keys
"
])
event_content
=
json
.
loads
(
row
[
"
unrecognized_keys
"
])
if
(
service
.
is_interested_in_user
(
if
(
service
.
is_interested_in_user
(
event_content
.
get
(
"
state_key
"
))):
event_content
.
get
(
"
state_key
"
))):
return
True
return
True
...
@@ -202,7 +202,7 @@ class StreamStore(SQLBaseStore):
...
@@ -202,7 +202,7 @@ class StreamStore(SQLBaseStore):
self
.
_set_before_and_after
(
ret
,
rows
)
self
.
_set_before_and_after
(
ret
,
rows
)
if
rows
:
if
rows
:
key
=
"
s%d
"
%
max
(
[
r
[
"
stream_ordering
"
]
for
r
in
rows
]
)
key
=
"
s%d
"
%
max
(
r
[
"
stream_ordering
"
]
for
r
in
rows
)
else
:
else
:
# Assume we didn't get anything because there was nothing to
# Assume we didn't get anything because there was nothing to
...
@@ -271,7 +271,7 @@ class StreamStore(SQLBaseStore):
...
@@ -271,7 +271,7 @@ class StreamStore(SQLBaseStore):
self
.
_set_before_and_after
(
ret
,
rows
)
self
.
_set_before_and_after
(
ret
,
rows
)
if
rows
:
if
rows
:
key
=
"
s%d
"
%
max
(
[
r
[
"
stream_ordering
"
]
for
r
in
rows
]
)
key
=
"
s%d
"
%
max
(
r
[
"
stream_ordering
"
]
for
r
in
rows
)
else
:
else
:
# Assume we didn't get anything because there was nothing to
# Assume we didn't get anything because there was nothing to
...
...
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