-
-
Save benaskins/390232 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task :cache => :environment do | |
hydra = Typhoeus::Hydra.hydra | |
Site.all.each do |site| | |
fork do | |
Locality.each_url(site.webservice_connection) do |url| | |
req = # build request | |
hydra.queue | |
end | |
end | |
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