lib/geonames_api/base.rb in geonames_api-0.1.2 vs lib/geonames_api/base.rb in geonames_api-0.1.3
- old
+ new
@@ -26,10 +26,12 @@
parse_response(response, params)
end
rescue Timeout => e
if retries_remaining > 0
retries_remaining -= 1
- sleep rand * GeoNamesAPI.max_sleep_time_between_retries
+ sleep_time = rand * GeoNamesAPI.max_sleep_time_between_retries
+ GeoNamesAPI.logger.info("GEONAMES RETRIABLE ERROR: #{e}. Retrying in #{sleep_time}s.") if GeoNamesAPI.logger
+ sleep sleep_time
retry
else
raise e
end
end