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

#159 filter selfnode from nodeslist #162

Merged
merged 1 commit into from
May 2, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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