summaryrefslogtreecommitdiff
path: root/lib/oxidized/core.rb
diff options
context:
space:
mode:
authorSaku Ytti <saku@ytti.fi>2014-02-23 19:11:29 +0200
committerSaku Ytti <saku@ytti.fi>2014-02-23 19:11:29 +0200
commit8880188001da23a5f0960e3970c4eb9bbd448306 (patch)
tree41a1f79450ff1683a2d5aa1f024a564e84230e25 /lib/oxidized/core.rb
parent06e5f68db6cfcbd80295874db1f00a25e8ba1229 (diff)
Migrate to sinatra/puma from webrick
As I can't do IO#select on sinatra/puma to run it when I have time, I have to run it on separate thread. This means Nodes container needs to be thread safe, it now has ghetto mutex locking, but I probably need to be be more focused what are the external methods that can be called and wrap those in @mutex.synchronize Provide also HTML UI not just JSON for ghetto UI to people who don't want to integrate
Diffstat (limited to 'lib/oxidized/core.rb')
-rw-r--r--lib/oxidized/core.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/oxidized/core.rb b/lib/oxidized/core.rb
index 59292f9..70e9e42 100644
--- a/lib/oxidized/core.rb
+++ b/lib/oxidized/core.rb
@@ -4,7 +4,7 @@ module Oxidized
require 'oxidized/worker'
require 'oxidized/nodes'
require 'oxidized/manager'
- require 'oxidized/api/rest'
+ require 'oxidized/api/web'
class << self
def new *args
Core.new args
@@ -16,7 +16,8 @@ module Oxidized
Oxidized.mgr = Manager.new
nodes = Nodes.new
@worker = Worker.new nodes
- @rest = API::Rest.new nodes, CFG.rest if CFG.rest
+ @rest = API::Web.new nodes, CFG.rest if CFG.rest
+ @rest.run
run
end
@@ -25,7 +26,7 @@ module Oxidized
def run
while true
@worker.work
- @rest ? @rest.work : sleep(Config::Sleep)
+ Config::Sleep
end
end
end