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
dae9a00a
Commit
dae9a00a
authored
7 years ago
by
Erik Johnston
Browse files
Options
Downloads
Patches
Plain Diff
Initialise exclusive_user_regex
parent
8177563e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
synapse/replication/slave/storage/appservice.py
+2
-0
2 additions, 0 deletions
synapse/replication/slave/storage/appservice.py
synapse/storage/appservice.py
+20
-15
20 additions, 15 deletions
synapse/storage/appservice.py
with
22 additions
and
15 deletions
synapse/replication/slave/storage/appservice.py
+
2
−
0
View file @
dae9a00a
...
...
@@ -16,6 +16,7 @@
from
._base
import
BaseSlavedStore
from
synapse.storage
import
DataStore
from
synapse.config.appservice
import
load_appservices
from
synapse.storage.appservice
import
_make_exclusive_regex
class
SlavedApplicationServiceStore
(
BaseSlavedStore
):
...
...
@@ -25,6 +26,7 @@ class SlavedApplicationServiceStore(BaseSlavedStore):
hs
.
config
.
server_name
,
hs
.
config
.
app_service_config_files
)
self
.
exclusive_user_regex
=
_make_exclusive_regex
(
self
.
services_cache
)
get_app_service_by_token
=
DataStore
.
get_app_service_by_token
.
__func__
get_app_service_by_user_id
=
DataStore
.
get_app_service_by_user_id
.
__func__
...
...
This diff is collapsed.
Click to expand it.
synapse/storage/appservice.py
+
20
−
15
View file @
dae9a00a
...
...
@@ -27,6 +27,25 @@ from ._base import SQLBaseStore
logger
=
logging
.
getLogger
(
__name__
)
def
_make_exclusive_regex
(
services_cache
):
# We precompie a regex constructed from all the regexes that the AS's
# have registered for exclusive users.
exclusive_user_regexes
=
[
regex
.
pattern
for
service
in
services_cache
for
regex
in
service
.
get_exlusive_user_regexes
()
]
if
exclusive_user_regexes
:
exclusive_user_regex
=
"
|
"
.
join
(
"
(
"
+
r
+
"
)
"
for
r
in
exclusive_user_regexes
)
exclusive_user_regex
=
re
.
compile
(
exclusive_user_regex
)
else
:
# We handle this case specially otherwise the constructed regex
# will always match
exclusive_user_regex
=
None
return
exclusive_user_regex
class
ApplicationServiceStore
(
SQLBaseStore
):
def
__init__
(
self
,
hs
):
...
...
@@ -36,21 +55,7 @@ class ApplicationServiceStore(SQLBaseStore):
hs
.
hostname
,
hs
.
config
.
app_service_config_files
)
# We precompie a regex constructed from all the regexes that the AS's
# have registered for exclusive users.
exclusive_user_regexes
=
[
regex
.
pattern
for
service
in
self
.
services_cache
for
regex
in
service
.
get_exlusive_user_regexes
()
]
if
exclusive_user_regexes
:
exclusive_user_regex
=
"
|
"
.
join
(
"
(
"
+
r
+
"
)
"
for
r
in
exclusive_user_regexes
)
self
.
exclusive_user_regex
=
re
.
compile
(
exclusive_user_regex
)
else
:
# We handle this case specially otherwise the constructed regex
# will always match
self
.
exclusive_user_regex
=
None
self
.
exclusive_user_regex
=
_make_exclusive_regex
(
self
.
services_cache
)
def
get_app_services
(
self
):
return
self
.
services_cache
...
...
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