diff options
author | Erik Johnston <erik@matrix.org> | 2018-05-30 11:35:02 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2018-05-30 11:35:02 +0100 |
commit | ecd4931ab2e23af66faa2b61dc2dec555e203aac (patch) | |
tree | 913eb0d89072acc77297dedbe423795bc2f0c14d /synapse/storage | |
parent | Remove redundant conditions (diff) | |
download | synapse-ecd4931ab2e23af66faa2b61dc2dec555e203aac.tar.xz |
Just iterate once rather than create a new set
Diffstat (limited to 'synapse/storage')
-rw-r--r-- | synapse/storage/events.py | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/synapse/storage/events.py b/synapse/storage/events.py index 2f648111b3..cad5086f5f 100644 --- a/synapse/storage/events.py +++ b/synapse/storage/events.py @@ -1503,24 +1503,17 @@ class EventsStore(EventsWorkerStore): retcol="chunk_id", ) - prev_chunk_ids = set( - pid for pid in prev_chunk_ids - if pid is not None and pid not in current_prev_ids and pid != chunk_id - ) - forward_chunk_ids = set( - fid for fid in forward_chunk_ids - if fid not in current_forward_ids and fid != chunk_id - ) - for pid in prev_chunk_ids: - # Note that the edge direction is reversed than what you might - # expect. See ChunkDBOrderedListStore for more details. - table.add_edge(pid, chunk_id) + if pid is not None and pid not in current_prev_ids and pid != chunk_id: + # Note that the edge direction is reversed than what you might + # expect. See ChunkDBOrderedListStore for more details. + table.add_edge(pid, chunk_id) for fid in forward_chunk_ids: # Note that the edge direction is reversed than what you might # expect. See ChunkDBOrderedListStore for more details. - table.add_edge(chunk_id, fid) + if fid not in current_forward_ids and fid != chunk_id: + table.add_edge(chunk_id, fid) # We now need to update the backwards extremities for the chunks. |