Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
make it work
Browse files Browse the repository at this point in the history
  • Loading branch information
ara4n committed Mar 13, 2018
1 parent f0f9a06 commit ccca028
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions synapse/handlers/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ def compute_state_delta(self, room_id, batch, sync_config, since_token, now_toke
if filter_members:
member_state_ids = {
t: state_ids[t]
for t in state_ids if t[0] == EventTypes.member
for t in state_ids if t[0] == EventTypes.Member
}

else:
Expand All @@ -511,7 +511,7 @@ def compute_state_delta(self, room_id, batch, sync_config, since_token, now_toke
if filter_members:
member_state_ids = {
t: state_ids[t]
for t in state_ids if t[0] == EventTypes.member
for t in state_ids if t[0] == EventTypes.Member
}

timeline_state = {
Expand Down Expand Up @@ -542,7 +542,7 @@ def compute_state_delta(self, room_id, batch, sync_config, since_token, now_toke
if filter_members:
member_state_ids = {
t: state_at_timeline_start[t]
for t in state_ids if t[0] == EventTypes.member
for t in state_ids if t[0] == EventTypes.Member
}

timeline_state = {
Expand Down
10 changes: 6 additions & 4 deletions synapse/storage/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,11 @@ def _get_state_groups_from_groups_txn(self, txn, groups, types=None):
if include_other_types:
# XXX: check whether this slows postgres down like a list of
# ORs does too?
unique_types = set([ t for (t, _) in types ])
clause_to_args.append(
(
"AND type <> ? " * len(types),
[t for (t, _) in types]
"AND type <> ? " * len(unique_types),
list(unique_types)
)
)
else:
Expand Down Expand Up @@ -293,10 +294,11 @@ def _get_state_groups_from_groups_txn(self, txn, groups, types=None):
where_args.extend([typ[0], typ[1]])

if include_other_types:
unique_types = set([ t for (t, _) in types ])
where_clauses.append(
"(" + " AND ".join(["type <> ?"] * len(types)) + ")"
"(" + " AND ".join(["type <> ?"] * len(unique_types)) + ")"
)
where_args.extend(t for (t, _) in types)
where_args.extend(list(unique_types))

where_clause = "AND (%s)" % (" OR ".join(where_clauses))
else:
Expand Down

0 comments on commit ccca028

Please sign in to comment.