Skip to content

Instantly share code, notes, and snippets.

@lachie
Created May 5, 2010 00:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save lachie/390226 to your computer and use it in GitHub Desktop.
Save lachie/390226 to your computer and use it in GitHub Desktop.
task :cache => :environment do
hydra = Typhoeus::Hydra.hydra
LocationWalker.each_location do |url|
req = # build request
hydra.queue
end
hydra.on_complete do |response|
if response.success?
LocationCacher.cache(response.body) # can give you headers too if you need 'em
else
# panic! hoptoad etc.
end
end
hydra.run
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment