Skip to content

Instantly share code, notes, and snippets.

@radixhound
Created June 3, 2011 22:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save radixhound/1007265 to your computer and use it in GitHub Desktop.
Save radixhound/1007265 to your computer and use it in GitHub Desktop.
EM::HttpRequest is blowing up here
def queue
@json_headers = { "Content-Type" => 'application/json', 'Accept' => 'application/json'}
if ::EM.reactor_running?
# EM.synchrony do #start a new fiber...
req = EM::HttpRequest.new(@@dispatcher_url)
puts "dispatching worker #{@body}"
req.apost({:head=>@json_headers, :body=>JSON.generate(@body)})
req.callback do
puts "dispatch worker - success!!"
[true, "Worker queued"]
end
req.errback do
puts "DISPATCH WORKER FAIL #{resp.error}"
[false, "Connection to dispacher FAIL - #{resp.error}"]
end
# end
else
#running from console - just CURL
req = "curl --url #{@@dispatcher_url} -H 'Content-Type: application/json' -H 'Accept: application/json' -d '#{JSON.generate(@body)}'"
puts "CURLING #{req}"
resp = `#{req}`
puts "resp= #{resp}"
end
end
dispatching worker {"photo_id"=>"139", "s3_key"=>"uploaded_images/2011/06/03/150941/yummyfood01.jpg", "thumbs"=>["145", "200", "300", "600"]}
dispatch worker - success!!
dispatching worker {"photo_id"=>"140", "s3_key"=>"uploaded_images/2011/06/03/150941/yummyfood01.jpg", "thumbs"=>["145", "200", "300", "600"]}
dispatch worker - success!!
dispatching worker {"photo_id"=>"141", "s3_key"=>"uploaded_images/2011/06/03/150942/yummyfood01.jpg", "thumbs"=>["145", "200", "300", "600"]}
dispatch worker - success!!
dispatching worker {"photo_id"=>"143", "s3_key"=>"uploaded_images/2011/06/03/150942/yummyfood01.jpg", "thumbs"=>["145", "200", "300", "600"]}
dispatching worker {"photo_id"=>"142", "s3_key"=>"uploaded_images/2011/06/03/150941/yummyfood01.jpg", "thumbs"=>["145", "200", "300", "600"]}
dispatch worker - success!!
dispatch worker - success!!
dispatching worker {"photo_id"=>"144", "s3_key"=>"uploaded_images/2011/06/03/150942/yummyfood01.jpg", "thumbs"=>["145", "200", "300", "600"]}
dispatch worker - success!!
dispatching worker {"photo_id"=>"145", "s3_key"=>"uploaded_images/2011/06/03/150944/yummyfood01.jpg", "thumbs"=>["145", "200", "300", "600"]}
dispatch worker - success!!
dispatching worker {"photo_id"=>"146", "s3_key"=>"uploaded_images/2011/06/03/150943/yummyfood01.jpg", "thumbs"=>["145", "200", "300", "600"]}
dispatch worker - success!!
dispatching worker {"photo_id"=>"147", "s3_key"=>"uploaded_images/2011/06/03/150945/yummyfood01.jpg", "thumbs"=>["145", "200", "300", "600"]}
dispatch worker - success!!
dispatching worker {"photo_id"=>"148", "s3_key"=>"uploaded_images/2011/06/03/150944/yummyfood01.jpg", "thumbs"=>["145", "200", "300", "600"]}
dispatch worker - success!!
dispatching worker {"photo_id"=>"149", "s3_key"=>"uploaded_images/2011/06/03/150947/yummyfood01.jpg", "thumbs"=>["145", "200", "300", "600"]}
dispatch worker - success!!
dispatching worker {"photo_id"=>"150", "s3_key"=>"uploaded_images/2011/06/03/150947/yummyfood01.jpg", "thumbs"=>["145", "200", "300", "600"]}
Assertion failed: (!bWatchOnly), function Write, file ed.cpp, line 848.
Abort trap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment