Skip to content

Commit

Permalink
FIX: Add a 3 second timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
nbianca committed Aug 2, 2023
1 parent df594da commit 0b13739
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/discourse_antivirus/clamav_services_pool.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

module DiscourseAntivirus
class ClamAVServicesPool
TIMEOUT = 3
UNAVAILABLE = "unavailable"

def self.correctly_configured?
Expand All @@ -26,7 +27,7 @@ def build_socket(target)
return if target.port.blank?

begin
TCPSocket.new(target.hostname, target.port)
TCPSocket.new(target.hostname, target.port, connect_timeout: TIMEOUT, timeout: TIMEOUT)
rescue StandardError
nil
end
Expand Down

0 comments on commit 0b13739

Please sign in to comment.