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
54a54609
Commit
54a54609
authored
9 years ago
by
Mark Haines
Browse files
Options
Downloads
Patches
Plain Diff
Add a response cache for getting the public room list
parent
191c7bef
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
synapse/handlers/room.py
+11
-1
11 additions, 1 deletion
synapse/handlers/room.py
with
11 additions
and
1 deletion
synapse/handlers/room.py
+
11
−
1
View file @
54a54609
...
@@ -25,6 +25,7 @@ from synapse.api.constants import (
...
@@ -25,6 +25,7 @@ from synapse.api.constants import (
from
synapse.api.errors
import
AuthError
,
StoreError
,
SynapseError
,
Codes
from
synapse.api.errors
import
AuthError
,
StoreError
,
SynapseError
,
Codes
from
synapse.util
import
stringutils
,
unwrapFirstError
from
synapse.util
import
stringutils
,
unwrapFirstError
from
synapse.util.logcontext
import
preserve_context_over_fn
from
synapse.util.logcontext
import
preserve_context_over_fn
from
synapse.util.caches.response_cache
import
ResponseCache
from
signedjson.sign
import
verify_signed_json
from
signedjson.sign
import
verify_signed_json
from
signedjson.key
import
decode_verify_key_bytes
from
signedjson.key
import
decode_verify_key_bytes
...
@@ -939,9 +940,18 @@ class RoomMemberHandler(BaseHandler):
...
@@ -939,9 +940,18 @@ class RoomMemberHandler(BaseHandler):
class
RoomListHandler
(
BaseHandler
):
class
RoomListHandler
(
BaseHandler
):
def
__init__
(
self
,
hs
):
super
(
RoomListHandler
,
self
).
__init__
(
hs
)
self
.
response_cache
=
ResponseCache
()
@defer.inlineCallbacks
def
get_public_room_list
(
self
):
def
get_public_room_list
(
self
):
result
=
self
.
response_cache
.
get
(())
if
not
result
:
result
=
self
.
response_cache
.
set
((),
self
.
_get_public_room_list
())
return
result
@defer.inlineCallbacks
def
_get_public_room_list
(
self
):
room_ids
=
yield
self
.
store
.
get_public_room_ids
()
room_ids
=
yield
self
.
store
.
get_public_room_ids
()
@defer.inlineCallbacks
@defer.inlineCallbacks
...
...
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