Just iterate once rather than create a new set

This commit is contained in:
Erik Johnston 2018-05-30 11:35:02 +01:00
parent 1cdd0d3b0d
commit ecd4931ab2
1 changed files with 6 additions and 13 deletions

View File

@ -1503,24 +1503,17 @@ class EventsStore(EventsWorkerStore):
retcol="chunk_id", 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: for pid in prev_chunk_ids:
# Note that the edge direction is reversed than what you might if pid is not None and pid not in current_prev_ids and pid != chunk_id:
# expect. See ChunkDBOrderedListStore for more details. # Note that the edge direction is reversed than what you might
table.add_edge(pid, chunk_id) # expect. See ChunkDBOrderedListStore for more details.
table.add_edge(pid, chunk_id)
for fid in forward_chunk_ids: for fid in forward_chunk_ids:
# Note that the edge direction is reversed than what you might # Note that the edge direction is reversed than what you might
# expect. See ChunkDBOrderedListStore for more details. # 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. # We now need to update the backwards extremities for the chunks.