lib/harvestdor-indexer.rb in harvestdor-indexer-0.0.10 vs lib/harvestdor-indexer.rb in harvestdor-indexer-0.0.11
- old
+ new
@@ -80,17 +80,18 @@
#add the document to solr, retry if an error occurs
def solr_add(doc, id, do_retry=true)
#if do_retry is false, skip retrying
tries=do_retry ? 0 : 999
- while tries < @max_retries
+ max_tries=@max_retries ? @max_retries : 5 #if @max_retries isn't set, use 5
+ while tries < max_tries
begin
tries+=1
solr_client.add(doc)
#return if successful
return
rescue => e
- if tries<@max_retries
+ if tries<max_tries
logger.warn "#{id}: #{e.message}, retrying"
else
@error_count+=1
logger.error "Failed saving #{id}: #{e.message}"
logger.error e.backtrace