Created
January 31, 2014 22:15
-
-
Save wrburgess/8744382 to your computer and use it in GitHub Desktop.
rails retry method with partial search results issue
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
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