Created
January 20, 2014 22:45
-
-
Save raypereda/8530921 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
def self.process_results(num) | |
client.process_results(num) do |address_hash| # Redis LPOP and a JSON parse should be fast | |
Nation.with(address_hash['passthrough']['nation_slug']) do # Is Nation.with slow??? | |
address = Address.find_by_id(address_hash['passthrough']['address_id']) # find_by_id is should be fast | |
next unless address | |
begin | |
address.update_geocode_data(address_hash) # Is update_geocode_data slow? | |
rescue ActiveRecord::RecordInvalid | |
address.increment_geocode_error_count # increment should be fast | |
end | |
address.save # save should be fast | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment