Permalink
Browse files

Actually run eventmachine, run_block doesn't seem to work

  • Loading branch information...
1 parent 30a0753 commit 9a3bd41e36490f55208df64bc8fc44e7fc11c1ea @qrush qrush committed Apr 23, 2011
Showing with 10 additions and 4 deletions.
  1. +10 −4 lib/daikon/client.rb
View
@@ -22,7 +22,7 @@ def connect
end
def start_monitor
- Monitor.start
+ Monitor.start(connect)
end
def log(message)
@@ -40,13 +40,19 @@ def request(method, path, options = {})
url = "#{config.server_prefix}#{path}"
options[:head] ||= {}
options[:head]['Authorization'] = config.api_key
+ options[:ssl] = {:verify_peer => true}
- log "#{method} #{options[:url]}"
+ log "#{method.to_s.upcase} #{url}"
- EventMachine.run_block do
+ EventMachine.run do
http = EventMachine::HttpRequest.new(url).send(method, options)
http.callback do
- log "=> #{http.response}"
+ log "SUCCESS: #{http.response}"
+ EM.stop
+ end
+ http.errback do
+ log "ERROR: #{http.response}"
+ EM.stop
end
end
end

0 comments on commit 9a3bd41

Please sign in to comment.