mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 09:12:45 +08:00
FinalDestination should only log when verbose is enabled
This commit is contained in:
parent
880d154381
commit
d1f257d275
|
@ -36,7 +36,8 @@ class FileHelper
|
|||
dest = FinalDestination.new(
|
||||
url,
|
||||
max_redirects: follow_redirect ? 5 : 1,
|
||||
skip_rate_limit: skip_rate_limit
|
||||
skip_rate_limit: skip_rate_limit,
|
||||
verbose: verbose
|
||||
)
|
||||
uri = dest.resolve
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@ class FinalDestination
|
|||
@http_verb = @force_get_hosts.any? { |host| hostname_matches?(host) } ? :get : :head
|
||||
@cookie = nil
|
||||
@limited_ips = []
|
||||
@verbose = @opts[:verbose] || false
|
||||
end
|
||||
|
||||
def self.connection_timeout
|
||||
|
@ -93,7 +94,7 @@ class FinalDestination
|
|||
|
||||
if @limit < 0
|
||||
@status = :too_many_redirects
|
||||
log(:warn, "FinalDestination could not resolve URL (too many redirects): #{@uri}")
|
||||
log(:warn, "FinalDestination could not resolve URL (too many redirects): #{@uri}") if @verbose
|
||||
return nil
|
||||
end
|
||||
|
||||
|
@ -105,7 +106,7 @@ class FinalDestination
|
|||
end
|
||||
|
||||
unless validate_uri
|
||||
log(:warn, "FinalDestination could not resolve URL (invalid URI): #{@uri}")
|
||||
log(:warn, "FinalDestination could not resolve URL (invalid URI): #{@uri}") if @verbose
|
||||
return nil
|
||||
end
|
||||
|
||||
|
@ -180,10 +181,10 @@ class FinalDestination
|
|||
@status = :failure
|
||||
@status_code = response.status
|
||||
|
||||
log(:warn, "FinalDestination could not resolve URL (status #{response.status}): #{@uri}")
|
||||
log(:warn, "FinalDestination could not resolve URL (status #{response.status}): #{@uri}") if @verbose
|
||||
nil
|
||||
rescue Excon::Errors::Timeout
|
||||
log(:warn, "FinalDestination could not resolve URL (timeout): #{@uri}")
|
||||
log(:warn, "FinalDestination could not resolve URL (timeout): #{@uri}") if @verbose
|
||||
nil
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user