Skip to content

Instantly share code, notes, and snippets.

@wrburgess
Created January 31, 2014 22:15
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 wrburgess/8744382 to your computer and use it in GitHub Desktop.
Save wrburgess/8744382 to your computer and use it in GitHub Desktop.
rails retry method with partial search results issue
begin
search = Clip.search_via_solr(@country, search_options)
response = search.instance_eval("@solr_result")["responseHeader"]
raise partial_results_flag if response["partialResults"].present?
rescue
max_search_attempts = 3
@retries ||= 0
if @retries < max_search_attempts
@retries += 1
Rails.logger.info "Search Retry \##{@retries}"
retry
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment