Class: Jekyll::JekyllFetch::Utils
- Inherits:
-
Object
- Object
- Jekyll::JekyllFetch::Utils
- Defined in:
- lib/jekyll-fetch.rb
Overview
Helper functions for HTTP requests
Class Method Summary collapse
Class Method Details
.config ⇒ Object
31 32 33 |
# File 'lib/jekyll-fetch.rb', line 31 def config @config ||= CONFIG.merge(JEKYLL_SITE.config['fetch'] || {}) end |
.fetch(uri_str, limit = 10) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/jekyll-fetch.rb', line 18 def fetch(uri_str, limit = 10) raise ArgumentError, 'Max retries reached' if limit.zero? begin unsafe_fetch(uri_str, limit) rescue Errno::ECONNREFUSED Jekyll.logger.warn "Connection refused for #{uri_str}, retrying in 2s..." sleep 2 Jekyll.logger.warn "Retrying (#{limit - 1} tries left)" fetch(uri_str, limit - 1) end end |