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

Commit

Permalink
Raft::Node runs automatically.
Browse files Browse the repository at this point in the history
  • Loading branch information
aflatter committed Jun 3, 2013
1 parent c343dad commit 92edaef
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ comes into play.
nodes = addresses.size.times.map do |i|
combination = addresses.rotate(i)
options = {listen: combination.first, peers: combination[1..-1]}
Raft::Node.new(listen: combination.first, peers: combination[1..-1]).tap { |node| node.run }
Raft::Node.new(listen: combination.first, peers: combination[1..-1])
end

# Give your nodes some time to start up.
Expand Down
2 changes: 2 additions & 0 deletions lib/raft/node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ def initialize(options = {}, &handler)
self.options = DEFAULT_OPTIONS.merge(options)
self.term = 0
self.log = Raft::Log.new

async.run
end

def run
Expand Down
2 changes: 0 additions & 2 deletions test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,4 @@
supervisor.supervise(Raft::Node, options)
end

supervisor.actors.each(&:run)

sleep

0 comments on commit 92edaef

Please sign in to comment.