Skip to content

Instantly share code, notes, and snippets.

@dsisnero
Created October 7, 2011 19:18
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 dsisnero/1271134 to your computer and use it in GitHub Desktop.
Save dsisnero/1271134 to your computer and use it in GitHub Desktop.
async_fetch
def async_fetch(url)
f = Fiber.current
http = EventMachine::HttpRequest.new(url).get :timeout => 10
http.callback { f.resume(http) }
http.errback { f.resume(http) }
return Fiber.yield
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment