yldio/skiff

no peer 'new state' event emitted on join

bhoriuchi opened this issue · 0 comments

I am not seeing a new state event fired from nodes that are added to the cluster via the .join method

Scenario:

I have a 2 node skiff cluster. node1 initializes with peers set to [] and become the leader, then sets an entry in a non-skiff controlled shared database saying it is the leader

node2 starts and checks the non-skiff controlled database for the leader and starts with peers set to [leaders muliaddr], then sends an event via socket.io to node1 requesting to join and sending its multiaddr address.

node1 receives the request and initiates a .join

at this point the joined event fires on both node1 and node2 but node2 does not fire a new state event.

when taking node1 down, node2 then fires a new state indicating that it is now a candidate

is this expected behavior for the .join method? If not, what is the best method for dynamically adding peers to a cluster w/o restarting each node with a complete/updated peer list?

additionally, when using the address 127.0.0.1 for both node1 and node2 on separate processes and different ports gives the following error

Error: timedout waiting for consensus
       at Timeout.onTimeout (/***/node_modules/skiff/lib/states/leader.js:122:19)
       at tryOnTimeout (timers.js:224:11)
       at Timer.listOnTimeout (timers.js:198:5) code: 'ETIMEOUT'