Skip to content

Commit

Permalink
Simplify Coordinator.advance_shards #17
Browse files Browse the repository at this point in the history
The inner `was_active = shard in self.active` was redundant,
because the only shards considered for removal were *from*
`self.active`.
  • Loading branch information
numberoverzero committed Oct 16, 2016
1 parent b662774 commit 61e76bd
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions bloop/stream/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,13 @@ def advance_shards(self) -> None:
shard.load_children()

# B) Remove the shard from the Coordinator. If the Shard has
# children and was active, those children are added to the active list
# children, those children are now active.
# If the Shard was a root, those children become roots.
was_active = shard in self.active
self.remove_shard(shard)

# C) If the shard was active, now its children are active.
# Move each child Shard to its trim_horizon.
if was_active:
for child in shard.children:
child.jump_to(iterator_type="trim_horizon")
# C) Move each child Shard to its trim_horizon.
for child in shard.children:
child.jump_to(iterator_type="trim_horizon")

def heartbeat(self) -> None:
# Try to keep active shards with ``latest`` and ``trim_horizon`` iterators alive.
Expand Down

0 comments on commit 61e76bd

Please sign in to comment.