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
35bb465b
Commit
35bb465b
authored
9 years ago
by
Erik Johnston
Browse files
Options
Downloads
Patches
Plain Diff
Filter rooms list before chunking
parent
c42f46ab
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/sync.py
+12
-6
12 additions, 6 deletions
synapse/handlers/sync.py
with
12 additions
and
6 deletions
synapse/handlers/sync.py
+
12
−
6
View file @
35bb465b
...
...
@@ -252,6 +252,18 @@ class SyncHandler(BaseHandler):
archived
=
[]
deferreds
=
[]
user_id
=
sync_config
.
user
.
to_string
()
def
_should_include_room
(
event
):
# Always send down rooms we were banned or kicked from.
if
not
sync_config
.
filter_collection
.
include_leave
:
if
event
.
membership
==
Membership
.
LEAVE
:
if
user_id
==
event
.
sender
:
return
False
return
True
room_list
=
filter
(
_should_include_room
,
room_list
)
room_list_chunks
=
[
room_list
[
i
:
i
+
10
]
for
i
in
xrange
(
0
,
len
(
room_list
),
10
)]
for
room_list_chunk
in
room_list_chunks
:
for
event
in
room_list_chunk
:
...
...
@@ -276,12 +288,6 @@ class SyncHandler(BaseHandler):
invite
=
invite
,
))
elif
event
.
membership
in
(
Membership
.
LEAVE
,
Membership
.
BAN
):
# Always send down rooms we were banned or kicked from.
if
not
sync_config
.
filter_collection
.
include_leave
:
if
event
.
membership
==
Membership
.
LEAVE
:
if
sync_config
.
user
.
to_string
()
==
event
.
sender
:
continue
leave_token
=
now_token
.
copy_and_replace
(
"
room_key
"
,
"
s%d
"
%
(
event
.
stream_ordering
,)
)
...
...
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