Skip to content

Instantly share code, notes, and snippets.

@raypereda
Created January 20, 2014 22:45
Show Gist options
  • Save raypereda/8530921 to your computer and use it in GitHub Desktop.
Save raypereda/8530921 to your computer and use it in GitHub Desktop.
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