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

Commit

Permalink
filter selfnode from nodeslist (#162)
Browse files Browse the repository at this point in the history
  • Loading branch information
jasongoodwin authored and hseeberger committed May 2, 2017
1 parent 6bf4b89 commit 857c9e4
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,19 @@ final class ConstructrMachine(
onTransition {
case _ -> State.GettingNodes =>
log.debug("Transitioning to GettingNodes")
coordination.getNodes().pipeTo(self)
coordination.getNodes().map { nodes =>
if(nodes.contains(selfNode))
log.warning(s"Selfnode received in list of nodes $nodes. Will filter to prevent forming an island.")

nodes.filterNot(_ == selfNode)
} pipeTo self
}

when(State.GettingNodes, coordinationTimeout) {
case Event(nodes: Set[Address] @unchecked, _) if nodes.isEmpty =>
log.debug("Received empty nodes, going to Locking")
goto(State.Locking).using(stateData.copy(nrOfRetriesLeft = nrOfRetries))
goto(State.Locking)
.using(stateData.copy(nrOfRetriesLeft = nrOfRetries))

case Event(nodes: Set[Address] @unchecked, _) =>
log.debug(s"Received nodes $nodes, going to Joining")
Expand Down

0 comments on commit 857c9e4

Please sign in to comment.