Skip to content

Commit

Permalink
Revert dynamic rescue, Ruby is savvy enough to handle this
Browse files Browse the repository at this point in the history
  • Loading branch information
mperham committed Feb 15, 2024
1 parent e681a8d commit 53cfe89
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
5 changes: 5 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changes

## 2.1.0

- Improve support for TLS connections [#84]
- Gracefully handle OpenSSL errors during transactions [#83]

## 2.0.0

- Allow more connections in pool [#455]
Expand Down
9 changes: 2 additions & 7 deletions lib/faktory/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,6 @@ def initialize(url: uri_from_env || "tcp://localhost:7419", debug: false, timeou
@debug = debug
@location = URI(url)
@timeout = timeout
@errors = [SystemCallError, SocketError, TimeoutError]

if tls?
require "openssl"
@errors << OpenSSL::SSL::SSLError
end

open_socket(@timeout)
end
Expand Down Expand Up @@ -257,6 +251,7 @@ def tls?
# NB: aliased by faktory/testing
def open_socket(timeout = DEFAULT_TIMEOUT)
if tls?
require "openssl"
sock = TCPSocket.new(@location.hostname, @location.port)
sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_KEEPALIVE, true)

Expand Down Expand Up @@ -335,7 +330,7 @@ def transaction

begin
yield
rescue *@errors
rescue SystemCallError, SocketError, TimeoutError, OpenSSL::SSL::SSLError
if retryable
retryable = false

Expand Down

0 comments on commit 53cfe89

Please sign in to comment.