diff --git a/app/logical/sources/strategies/base.rb b/app/logical/sources/strategies/base.rb index e17aa9541..84a4c628b 100644 --- a/app/logical/sources/strategies/base.rb +++ b/app/logical/sources/strategies/base.rb @@ -18,6 +18,9 @@ module Sources class Base class DownloadError < StandardError; end + # The http timeout to download a file. + DOWNLOAD_TIMEOUT = 60 + attr_reader :url, :referer_url, :urls, :parsed_url, :parsed_referer, :parsed_urls extend Memoist @@ -228,14 +231,9 @@ module Sources end memoize :http - # The http timeout to download a file. Overrideable by each site - def download_timeout - 30 - end - # A http client for downloading files. def http_downloader - http.timeout(download_timeout).max_size(Danbooru.config.max_file_size).use(:spoof_referrer).use(:unpolish_cloudflare) + http.timeout(DOWNLOAD_TIMEOUT).max_size(Danbooru.config.max_file_size).use(:spoof_referrer).use(:unpolish_cloudflare) end memoize :http_downloader diff --git a/app/logical/sources/strategies/lofter.rb b/app/logical/sources/strategies/lofter.rb index 870c945a5..5272d44c3 100644 --- a/app/logical/sources/strategies/lofter.rb +++ b/app/logical/sources/strategies/lofter.rb @@ -103,10 +103,6 @@ module Sources def artist_name urls.map { |u| u[PROFILE_URL, :artist_name] || u[PAGE_URL, :artist_name] }.compact.first end - - def download_timeout - 60 - end end end end