uploads: raise download timeout.
Raise the timeout for downloading files from the source to 60 seconds globally. Previously had a lower timeout because uploads were processed in the foreground when not using the bookmarklet, and we didn't want to tie up Puma worker processes with slow downloads. Now that all uploads are processed in the background, we can have a higher timeout.
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user