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
068aa1d2
Commit
068aa1d2
authored
6 years ago
by
Andrew Morgan
Browse files
Options
Downloads
Patches
Plain Diff
Time out filtered room dir queries after 60s
parent
58f6c481
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_list.py
+12
-2
12 additions, 2 deletions
synapse/handlers/room_list.py
with
12 additions
and
2 deletions
synapse/handlers/room_list.py
+
12
−
2
View file @
068aa1d2
...
...
@@ -31,6 +31,7 @@ from synapse.util.caches.descriptors import cachedInlineCallbacks
from
synapse.util.caches.response_cache
import
ResponseCache
from
._base
import
BaseHandler
from
datetime
import
datetime
,
timedelta
logger
=
logging
.
getLogger
(
__name__
)
...
...
@@ -73,8 +74,13 @@ class RoomListHandler(BaseHandler):
# We explicitly don't bother caching searches or requests for
# appservice specific lists.
logger
.
info
(
"
Bypassing cache as search request.
"
)
# XXX: Quick hack to stop room directory queries taking too long.
# Timeout request after 60s. Probably want a more fundamental
# solution at some point
timeout
=
datetime
.
now
()
+
timedelta
(
seconds
=
60
)
return
self
.
_get_public_room_list
(
limit
,
since_token
,
search_filter
,
network_tuple
=
network_tuple
,
limit
,
since_token
,
search_filter
,
network_tuple
=
network_tuple
,
timeout
=
timeout
,
)
key
=
(
limit
,
since_token
,
network_tuple
)
...
...
@@ -87,7 +93,8 @@ class RoomListHandler(BaseHandler):
@defer.inlineCallbacks
def
_get_public_room_list
(
self
,
limit
=
None
,
since_token
=
None
,
search_filter
=
None
,
network_tuple
=
EMPTY_THIRD_PARTY_ID
,):
network_tuple
=
EMPTY_THIRD_PARTY_ID
,
timeout
=
None
,):
if
since_token
and
since_token
!=
"
END
"
:
since_token
=
RoomListNextBatch
.
from_token
(
since_token
)
else
:
...
...
@@ -202,6 +209,9 @@ class RoomListHandler(BaseHandler):
chunk
=
[]
for
i
in
range
(
0
,
len
(
rooms_to_scan
),
step
):
if
timeout
and
datetime
.
now
()
>
timeout
:
raise
Exception
(
"
Timed out searching room directory
"
)
batch
=
rooms_to_scan
[
i
:
i
+
step
]
logger
.
info
(
"
Processing %i rooms for result
"
,
len
(
batch
))
yield
concurrently_execute
(
...
...
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