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
72d84064
Commit
72d84064
authored
10 years ago
by
Paul "LeoNerd" Evans
Browse files
Options
Downloads
Patches
Plain Diff
Put a cache on get_aliases_for_room
parent
a63b4f71
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/directory.py
+8
-2
8 additions, 2 deletions
synapse/storage/directory.py
with
8 additions
and
2 deletions
synapse/storage/directory.py
+
8
−
2
View file @
72d84064
...
...
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from
._base
import
SQLBaseStore
from
._base
import
SQLBaseStore
,
cached
from
synapse.api.errors
import
SynapseError
...
...
@@ -106,14 +106,19 @@ class DirectoryStore(SQLBaseStore):
},
desc
=
"
create_room_alias_association
"
,
)
self
.
get_aliases_for_room
.
invalidate
(
room_id
)
@defer.inlineCallbacks
def
delete_room_alias
(
self
,
room_alias
):
r
eturn
self
.
runInteraction
(
r
oom_id
=
yield
self
.
runInteraction
(
"
delete_room_alias
"
,
self
.
_delete_room_alias_txn
,
room_alias
,
)
self
.
get_aliases_for_room
.
invalidate
(
room_id
)
defer
.
returnValue
(
room_id
)
def
_delete_room_alias_txn
(
self
,
txn
,
room_alias
):
cursor
=
txn
.
execute
(
"
SELECT room_id FROM room_aliases WHERE room_alias = ?
"
,
...
...
@@ -138,6 +143,7 @@ class DirectoryStore(SQLBaseStore):
return
room_id
@cached
()
def
get_aliases_for_room
(
self
,
room_id
):
return
self
.
_simple_select_onecol
(
"
room_aliases
"
,
...
...
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