faktory_worker_ruby 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fe9fd54ed547e42b198c7cf2e2f056203857f0f16a65aafe7126006102f86b3b
4
- data.tar.gz: 9ce604181600566d5991a3e9419f8b48a68d1cf657e8731ef5440eeadff5c4e7
3
+ metadata.gz: effc5e0683ad3dda06516e048c0855a9a7eabfeac799bc20340a01ea181c531e
4
+ data.tar.gz: 76e824912d51ac9e9d53f8971076d8155dbb4c74448a3f47bdbba663bb824f9a
5
5
  SHA512:
6
- metadata.gz: a344b74590b7e16f361fe2be34b69f1d7b07934f59cad91bc06b21dbc619638ac001591e3a5f3e91dabd57526ce1a612f3f28217fe8b61e28b3a29da3104cb0b
7
- data.tar.gz: a23358b7b261355de860f811b33218704e0d1ee760b794dec7977137e3b2996c8badab2bf0d9d420d468ed539c4b07c6b893a7e99c761659187ae081a3343ef4
6
+ metadata.gz: 24a4d33c1eb0b81ed82664d2b1ad4b8f3c0a608f49b567f89adfbed85bd2bdfc2d667b2745a997229cda9c06b81b19d552b5a852dc6ea70b563bf61e176b8819
7
+ data.tar.gz: 6fa8af5d29d4eede89e51ef35be4a9e789a677518655e592a5c6ad95ab495e62443cd9a9b837cb88dba7f1b14aa326b1eec14eb0223c4ba9184093fb181fb5c3
data/Changes.md CHANGED
@@ -1,6 +1,12 @@
1
1
  # Changes
2
2
 
3
- ## HEAD
3
+ ## 2.1.0
4
+
5
+ - Require ActiveJob 7.0+, connection_pool 2.5+
6
+ - Improve support for TLS connections [#84]
7
+ - Gracefully handle OpenSSL errors during transactions [#83]
8
+
9
+ ## 2.0.0
4
10
 
5
11
  - Allow more connections in pool [#455]
6
12
  - Minimum Ruby version is now 2.7.
data/Gemfile.lock CHANGED
@@ -1,92 +1,100 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- faktory_worker_ruby (2.0.0)
5
- connection_pool (~> 2.2, >= 2.2.2)
4
+ faktory_worker_ruby (2.1.0)
5
+ connection_pool (~> 2.5)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activejob (7.1.3)
11
- activesupport (= 7.1.3)
10
+ activejob (8.0.2)
11
+ activesupport (= 8.0.2)
12
12
  globalid (>= 0.3.6)
13
- activesupport (7.1.3)
13
+ activesupport (8.0.2)
14
14
  base64
15
+ benchmark (>= 0.3)
15
16
  bigdecimal
16
- concurrent-ruby (~> 1.0, >= 1.0.2)
17
+ concurrent-ruby (~> 1.0, >= 1.3.1)
17
18
  connection_pool (>= 2.2.5)
18
19
  drb
19
20
  i18n (>= 1.6, < 2)
21
+ logger (>= 1.4.2)
20
22
  minitest (>= 5.1)
21
- mutex_m
22
- tzinfo (~> 2.0)
23
- ast (2.4.2)
23
+ securerandom (>= 0.3)
24
+ tzinfo (~> 2.0, >= 2.0.5)
25
+ uri (>= 0.13.1)
26
+ ast (2.4.3)
24
27
  base64 (0.2.0)
25
- bigdecimal (3.1.6)
26
- concurrent-ruby (1.2.3)
27
- connection_pool (2.4.1)
28
- docile (1.4.0)
29
- drb (2.2.0)
30
- ruby2_keywords
28
+ benchmark (0.4.0)
29
+ bigdecimal (3.1.9)
30
+ concurrent-ruby (1.3.5)
31
+ connection_pool (2.5.3)
32
+ docile (1.4.1)
33
+ drb (2.2.1)
31
34
  globalid (1.2.1)
32
35
  activesupport (>= 6.1)
33
- i18n (1.14.1)
36
+ i18n (1.14.7)
34
37
  concurrent-ruby (~> 1.0)
35
- json (2.7.1)
36
- language_server-protocol (3.17.0.3)
38
+ json (2.11.3)
39
+ language_server-protocol (3.17.0.4)
37
40
  lint_roller (1.1.0)
38
- minitest (5.21.2)
39
- minitest-hooks (1.5.1)
41
+ logger (1.7.0)
42
+ minitest (5.25.5)
43
+ minitest-hooks (1.5.2)
40
44
  minitest (> 5.3)
41
- mutex_m (0.2.0)
42
- parallel (1.24.0)
43
- parser (3.3.0.4)
45
+ parallel (1.27.0)
46
+ parser (3.3.8.0)
44
47
  ast (~> 2.4.1)
45
48
  racc
46
- racc (1.7.3)
49
+ prism (1.4.0)
50
+ racc (1.8.1)
47
51
  rainbow (3.1.1)
48
- rake (13.1.0)
49
- regexp_parser (2.9.0)
50
- rexml (3.2.6)
51
- rubocop (1.59.0)
52
+ rake (13.2.1)
53
+ regexp_parser (2.10.0)
54
+ rubocop (1.75.5)
52
55
  json (~> 2.3)
53
- language_server-protocol (>= 3.17.0)
56
+ language_server-protocol (~> 3.17.0.2)
57
+ lint_roller (~> 1.1.0)
54
58
  parallel (~> 1.10)
55
- parser (>= 3.2.2.4)
59
+ parser (>= 3.3.0.2)
56
60
  rainbow (>= 2.2.2, < 4.0)
57
- regexp_parser (>= 1.8, < 3.0)
58
- rexml (>= 3.2.5, < 4.0)
59
- rubocop-ast (>= 1.30.0, < 2.0)
61
+ regexp_parser (>= 2.9.3, < 3.0)
62
+ rubocop-ast (>= 1.44.0, < 2.0)
60
63
  ruby-progressbar (~> 1.7)
61
- unicode-display_width (>= 2.4.0, < 3.0)
62
- rubocop-ast (1.30.0)
63
- parser (>= 3.2.1.0)
64
- rubocop-performance (1.20.2)
65
- rubocop (>= 1.48.1, < 2.0)
66
- rubocop-ast (>= 1.30.0, < 2.0)
64
+ unicode-display_width (>= 2.4.0, < 4.0)
65
+ rubocop-ast (1.44.1)
66
+ parser (>= 3.3.7.2)
67
+ prism (~> 1.4)
68
+ rubocop-performance (1.25.0)
69
+ lint_roller (~> 1.1)
70
+ rubocop (>= 1.75.0, < 2.0)
71
+ rubocop-ast (>= 1.38.0, < 2.0)
67
72
  ruby-progressbar (1.13.0)
68
- ruby2_keywords (0.0.5)
73
+ securerandom (0.4.1)
69
74
  simplecov (0.22.0)
70
75
  docile (~> 1.1)
71
76
  simplecov-html (~> 0.11)
72
77
  simplecov_json_formatter (~> 0.1)
73
- simplecov-html (0.12.3)
78
+ simplecov-html (0.13.1)
74
79
  simplecov_json_formatter (0.1.4)
75
- standard (1.33.0)
80
+ standard (1.49.0)
76
81
  language_server-protocol (~> 3.17.0.2)
77
82
  lint_roller (~> 1.0)
78
- rubocop (~> 1.59.0)
83
+ rubocop (~> 1.75.2)
79
84
  standard-custom (~> 1.0.0)
80
- standard-performance (~> 1.3)
85
+ standard-performance (~> 1.8)
81
86
  standard-custom (1.0.2)
82
87
  lint_roller (~> 1.0)
83
88
  rubocop (~> 1.50)
84
- standard-performance (1.3.1)
89
+ standard-performance (1.8.0)
85
90
  lint_roller (~> 1.1)
86
- rubocop-performance (~> 1.20.2)
91
+ rubocop-performance (~> 1.25.0)
87
92
  tzinfo (2.0.6)
88
93
  concurrent-ruby (~> 1.0)
89
- unicode-display_width (2.5.0)
94
+ unicode-display_width (3.1.4)
95
+ unicode-emoji (~> 4.0, >= 4.0.4)
96
+ unicode-emoji (4.0.4)
97
+ uri (1.0.3)
90
98
 
91
99
  PLATFORMS
92
100
  ruby
data/README.md CHANGED
@@ -34,10 +34,10 @@ server part is [here](https://github.com/contribsys/faktory/)
34
34
 
35
35
  ## Requirements
36
36
 
37
- * Ruby 2.5 or higher
38
- * Faktory 1.2 or higher [Installation](https://github.com/contribsys/faktory/wiki/Installation)
37
+ * Ruby 2.7 or higher
38
+ * Faktory 1.8 or higher [Installation](https://github.com/contribsys/faktory/wiki/Installation)
39
39
 
40
- Optionally, Rails 5.2+ for ActiveJob.
40
+ Optionally, Rails 6.0+ for ActiveJob.
41
41
 
42
42
  ## Installation
43
43
 
@@ -79,7 +79,7 @@ bundle exec faktory-worker
79
79
 
80
80
  Sidekiq is awesome; it's stable and useful. It suffers from two design limitations:
81
81
 
82
- 1. Sidekiq uses Redis and Redis is dumb datastore, all Sidekiq features are
82
+ 1. Sidekiq uses Redis and Redis is a plain datastore, all Sidekiq features are
83
83
  implemented in Ruby and have to travel over the network to access data.
84
84
  2. Because of (1), Sidekiq is limited to Ruby. You can't execute jobs
85
85
  with, e.g., Python and get the same Sidekiq features.
@@ -97,4 +97,4 @@ PRs to improve this are very welcome).
97
97
 
98
98
  ## Author
99
99
 
100
- Mike Perham, @getajobmike, mike @ contribsys.com
100
+ Mike Perham, [@getajobmike](https://ruby.social/@getajobmike), mike @ contribsys.com
@@ -22,8 +22,8 @@ Gem::Specification.new do |gem|
22
22
  "source_code_uri" => "https://github.com/contribsys/faktory_worker_ruby"
23
23
  }
24
24
 
25
- gem.add_dependency "connection_pool", "~> 2.2", ">= 2.2.2"
26
- gem.add_development_dependency "activejob", ">= 6.0.0"
25
+ gem.add_dependency "connection_pool", "~> 2.5"
26
+ gem.add_development_dependency "activejob", ">= 7.0.0"
27
27
  gem.add_development_dependency "minitest", "~> 5"
28
28
  gem.add_development_dependency "minitest-hooks"
29
29
  gem.add_development_dependency "rake"
@@ -4,7 +4,6 @@ require "uri"
4
4
  require "cgi"
5
5
  require "digest"
6
6
  require "securerandom"
7
- require "timeout"
8
7
  require "faktory/io"
9
8
 
10
9
  module Faktory
@@ -55,9 +54,9 @@ module Faktory
55
54
  super
56
55
  @debug = debug
57
56
  @location = URI(url)
58
- @timeout = timeout
57
+ @sock = nil
59
58
 
60
- open_socket(@timeout)
59
+ open_socket
61
60
  end
62
61
 
63
62
  def close
@@ -240,7 +239,7 @@ module Faktory
240
239
  private
241
240
 
242
241
  def debug(line)
243
- puts line
242
+ Faktory.logger.info(line)
244
243
  end
245
244
 
246
245
  def tls?
@@ -249,18 +248,23 @@ module Faktory
249
248
  end
250
249
 
251
250
  # NB: aliased by faktory/testing
252
- def open_socket(timeout = DEFAULT_TIMEOUT)
251
+ def open_socket
252
+ tlserrors = []
253
253
  if tls?
254
254
  require "openssl"
255
+ tlserrors << ::OpenSSL::SSL::SSLError
255
256
  sock = TCPSocket.new(@location.hostname, @location.port)
256
257
  sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_KEEPALIVE, true)
257
258
 
258
259
  ctx = OpenSSL::SSL::SSLContext.new
259
- ctx.set_params(verify_mode: OpenSSL::SSL::VERIFY_PEER)
260
260
  ctx.min_version = OpenSSL::SSL::TLS1_2_VERSION
261
+ ENV["FAKTORY_DISABLE_HOSTNAME_VERIFICATION"] ?
262
+ ctx.set_params(verify_mode: OpenSSL::SSL::VERIFY_NONE) :
263
+ ctx.set_params(verify_mode: OpenSSL::SSL::VERIFY_PEER)
261
264
 
262
265
  @sock = OpenSSL::SSL::SSLSocket.new(sock, ctx).tap do |socket|
263
266
  socket.sync_close = true
267
+ socket.hostname = @location.hostname
264
268
  socket.connect
265
269
  end
266
270
  else
@@ -302,6 +306,20 @@ module Faktory
302
306
 
303
307
  command("HELLO", Faktory.dump_json(payload))
304
308
  ok
309
+ rescue Errno::ECONNRESET, Faktory::TimeoutError
310
+ # A tcp client talking to a TLS server will get ECONNRESET
311
+ if tls?
312
+ raise
313
+ else
314
+ raise("Server using TLS? Use FAKTORY_URL=tcp+tls://... to enable encryption")
315
+ end
316
+ rescue *tlserrors
317
+ # A TLS client talking to a TCP server will get OpenSSL::SSL::SSLError
318
+ if tls?
319
+ raise("Server not using TLS? Use FAKTORY_URL=tcp://... to disable encryption")
320
+ else
321
+ raise
322
+ end
305
323
  end
306
324
 
307
325
  def command(*args)
@@ -317,11 +335,11 @@ module Faktory
317
335
  # have an underlying socket. Now if you disable testing and try to use that
318
336
  # client, it will crash without a socket. This open() handles that case to
319
337
  # transparently open a socket.
320
- open_socket(@timeout) if !@sock
338
+ open_socket if !@sock
321
339
 
322
340
  begin
323
341
  yield
324
- rescue SystemCallError, SocketError, TimeoutError
342
+ rescue SystemCallError, SocketError, Faktory::TimeoutError, OpenSSL::SSL::SSLError
325
343
  if retryable
326
344
  retryable = false
327
345
 
@@ -331,7 +349,7 @@ module Faktory
331
349
  nil
332
350
  end
333
351
  @sock = nil
334
- open_socket(@timeout)
352
+ open_socket
335
353
  retry
336
354
  else
337
355
  raise
data/lib/faktory/io.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require "io/wait"
2
+ require "timeout"
2
3
 
3
4
  # this is the necessary magic to get a line-oriented protocol to
4
5
  # respect a read timeout. unfortunately Ruby sockets do not provide any
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Faktory
4
- VERSION = "2.0.0"
4
+ VERSION = "2.1.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faktory_worker_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Perham
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-01-20 00:00:00.000000000 Z
10
+ date: 2025-05-08 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: connection_pool
@@ -16,34 +15,28 @@ dependencies:
16
15
  requirements:
17
16
  - - "~>"
18
17
  - !ruby/object:Gem::Version
19
- version: '2.2'
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: 2.2.2
18
+ version: '2.5'
23
19
  type: :runtime
24
20
  prerelease: false
25
21
  version_requirements: !ruby/object:Gem::Requirement
26
22
  requirements:
27
23
  - - "~>"
28
24
  - !ruby/object:Gem::Version
29
- version: '2.2'
30
- - - ">="
31
- - !ruby/object:Gem::Version
32
- version: 2.2.2
25
+ version: '2.5'
33
26
  - !ruby/object:Gem::Dependency
34
27
  name: activejob
35
28
  requirement: !ruby/object:Gem::Requirement
36
29
  requirements:
37
30
  - - ">="
38
31
  - !ruby/object:Gem::Version
39
- version: 6.0.0
32
+ version: 7.0.0
40
33
  type: :development
41
34
  prerelease: false
42
35
  version_requirements: !ruby/object:Gem::Requirement
43
36
  requirements:
44
37
  - - ">="
45
38
  - !ruby/object:Gem::Version
46
- version: 6.0.0
39
+ version: 7.0.0
47
40
  - !ruby/object:Gem::Dependency
48
41
  name: minitest
49
42
  requirement: !ruby/object:Gem::Requirement
@@ -139,7 +132,6 @@ metadata:
139
132
  documentation_uri: https://github.com/contribsys/faktory_worker_ruby/wiki
140
133
  changelog_uri: https://github.com/contribsys/faktory_worker_ruby/blob/master/Changes.md
141
134
  source_code_uri: https://github.com/contribsys/faktory_worker_ruby
142
- post_install_message:
143
135
  rdoc_options: []
144
136
  require_paths:
145
137
  - lib
@@ -154,8 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
154
146
  - !ruby/object:Gem::Version
155
147
  version: '0'
156
148
  requirements: []
157
- rubygems_version: 3.4.20
158
- signing_key:
149
+ rubygems_version: 3.6.2
159
150
  specification_version: 4
160
151
  summary: Ruby worker for Faktory
161
152
  test_files: []