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
81570abf
Commit
81570abf
authored
8 years ago
by
Erik Johnston
Browse files
Options
Downloads
Patches
Plain Diff
Handle fact that _generate_room_entry may not return a room entry
parent
a298331d
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/handlers/room_list.py
+25
-12
25 additions, 12 deletions
synapse/handlers/room_list.py
with
25 additions
and
12 deletions
synapse/handlers/room_list.py
+
25
−
12
View file @
81570abf
...
...
@@ -135,21 +135,34 @@ class RoomListHandler(BaseHandler):
rooms_to_scan
=
rooms_to_scan
[:
since_token
.
current_limit
]
rooms_to_scan
.
reverse
()
# If there's no search filter just limit the range since we'll
# return the vast majority of things.
if
limit
and
not
search_filter
:
rooms_to_scan
=
rooms_to_scan
[:
limit
+
1
]
# Actually generate the entries. _generate_room_entry will append to
# chunk but will stop if len(chunk) > limit
chunk
=
[]
yield
concurrently_execute
(
lambda
r
:
self
.
_generate_room_entry
(
r
,
rooms_to_num_joined
[
r
],
chunk
,
limit
,
search_filter
),
rooms_to_scan
,
10
)
if
limit
and
not
search_filter
:
step
=
limit
+
1
for
i
in
xrange
(
0
,
len
(
rooms_to_scan
),
step
):
# We iterate here because the vast majority of cases we'll stop
# at first iteration, but occaisonally _generate_room_entry
# won't append to the chunk and so we need to loop again.
# We don't want to scan over the entire range either as that
# would potentially waste a lot of work.
yield
concurrently_execute
(
lambda
r
:
self
.
_generate_room_entry
(
r
,
rooms_to_num_joined
[
r
],
chunk
,
limit
,
search_filter
),
rooms_to_scan
[
i
:
i
+
step
],
10
)
if
len
(
chunk
)
>=
limit
+
1
:
break
else
:
yield
concurrently_execute
(
lambda
r
:
self
.
_generate_room_entry
(
r
,
rooms_to_num_joined
[
r
],
chunk
,
limit
,
search_filter
),
rooms_to_scan
,
5
)
chunk
.
sort
(
key
=
lambda
e
:
(
-
e
[
"
num_joined_members
"
],
e
[
"
room_id
"
]))
...
...
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