diff options
Diffstat (limited to 'lib/oxidized/core.rb')
-rw-r--r-- | lib/oxidized/core.rb | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/oxidized/core.rb b/lib/oxidized/core.rb index 76aa330..59292f9 100644 --- a/lib/oxidized/core.rb +++ b/lib/oxidized/core.rb @@ -4,6 +4,7 @@ module Oxidized require 'oxidized/worker' require 'oxidized/nodes' require 'oxidized/manager' + require 'oxidized/api/rest' class << self def new *args Core.new args @@ -14,8 +15,18 @@ module Oxidized def initialize args Oxidized.mgr = Manager.new nodes = Nodes.new - worker = Worker.new nodes - loop { worker.work; sleep 1 } + @worker = Worker.new nodes + @rest = API::Rest.new nodes, CFG.rest if CFG.rest + run + end + + private + + def run + while true + @worker.work + @rest ? @rest.work : sleep(Config::Sleep) + end end end end |