faktory_worker_ruby 2.0.0 → 2.1.1

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: 8df3ceda59c66e2bcb7d04f70fec7de89e6a6219f9159420a9500df7c8a0d35b
4
+ data.tar.gz: 258295f65b955167b9d89f66aada3b28675368d835362edef694bd50b10f57cd
5
5
  SHA512:
6
- metadata.gz: a344b74590b7e16f361fe2be34b69f1d7b07934f59cad91bc06b21dbc619638ac001591e3a5f3e91dabd57526ce1a612f3f28217fe8b61e28b3a29da3104cb0b
7
- data.tar.gz: a23358b7b261355de860f811b33218704e0d1ee760b794dec7977137e3b2996c8badab2bf0d9d420d468ed539c4b07c6b893a7e99c761659187ae081a3343ef4
6
+ metadata.gz: 0b02206889ca2ff8b57f3de485a880904b9eb8e422975e78ed23176e753b4cc5ce7d4eca76f65f7f9b0c49c0440503892e26cdc9f960d170a076f8d49570a4d1
7
+ data.tar.gz: 7e7065afe15d6308245131ab4524fd5d2accdf51590817c91cd83beededd356a3bc4e0132cfc42f1eeb2bfc13bb367eecf8087f6c225d4a939d2f05828709662
data/Changes.md CHANGED
@@ -1,6 +1,18 @@
1
1
  # Changes
2
2
 
3
- ## HEAD
3
+ ## 2.1.1
4
+
5
+ - Add new `Faktory::Client#queue_latency` API
6
+ - Require OpenSSL for client
7
+ - Bump requirements for Ruby, Rails
8
+
9
+ ## 2.1.0
10
+
11
+ - Require ActiveJob 7.0+, connection_pool 2.5+
12
+ - Improve support for TLS connections [#84]
13
+ - Gracefully handle OpenSSL errors during transactions [#83]
14
+
15
+ ## 2.0.0
4
16
 
5
17
  - Allow more connections in pool [#455]
6
18
  - 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 3.2 or higher
38
+ * Faktory 1.9 or higher [Installation](https://github.com/contribsys/faktory/wiki/Installation)
39
39
 
40
- Optionally, Rails 5.2+ for ActiveJob.
40
+ Optionally, Rails 7.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,8 +4,8 @@ require "uri"
4
4
  require "cgi"
5
5
  require "digest"
6
6
  require "securerandom"
7
- require "timeout"
8
7
  require "faktory/io"
8
+ require "openssl"
9
9
 
10
10
  module Faktory
11
11
  class BaseError < StandardError; end
@@ -55,9 +55,9 @@ module Faktory
55
55
  super
56
56
  @debug = debug
57
57
  @location = URI(url)
58
- @timeout = timeout
58
+ @sock = nil
59
59
 
60
- open_socket(@timeout)
60
+ open_socket
61
61
  end
62
62
 
63
63
  def close
@@ -159,6 +159,15 @@ module Faktory
159
159
  end
160
160
  end
161
161
 
162
+ def queue_latency(*queues)
163
+ qs = Array(queues)
164
+ raise ArgumentError, "no queue given" if qs.empty?
165
+ transaction do
166
+ command "QUEUE LATENCY", qs.join(" ")
167
+ JSON.parse(result!)
168
+ end
169
+ end
170
+
162
171
  # Push a hash corresponding to a job payload to Faktory.
163
172
  # Hash must contain "jid", "jobtype" and "args" elements at minimum.
164
173
  # Returned value will either be the JID String if successful OR
@@ -240,7 +249,7 @@ module Faktory
240
249
  private
241
250
 
242
251
  def debug(line)
243
- puts line
252
+ Faktory.logger.info(line)
244
253
  end
245
254
 
246
255
  def tls?
@@ -249,18 +258,22 @@ module Faktory
249
258
  end
250
259
 
251
260
  # NB: aliased by faktory/testing
252
- def open_socket(timeout = DEFAULT_TIMEOUT)
261
+ def open_socket
262
+ tlserrors = []
253
263
  if tls?
254
- require "openssl"
264
+ tlserrors << ::OpenSSL::SSL::SSLError
255
265
  sock = TCPSocket.new(@location.hostname, @location.port)
256
266
  sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_KEEPALIVE, true)
257
267
 
258
268
  ctx = OpenSSL::SSL::SSLContext.new
259
- ctx.set_params(verify_mode: OpenSSL::SSL::VERIFY_PEER)
260
269
  ctx.min_version = OpenSSL::SSL::TLS1_2_VERSION
270
+ ENV["FAKTORY_DISABLE_HOSTNAME_VERIFICATION"] ?
271
+ ctx.set_params(verify_mode: OpenSSL::SSL::VERIFY_NONE) :
272
+ ctx.set_params(verify_mode: OpenSSL::SSL::VERIFY_PEER)
261
273
 
262
274
  @sock = OpenSSL::SSL::SSLSocket.new(sock, ctx).tap do |socket|
263
275
  socket.sync_close = true
276
+ socket.hostname = @location.hostname
264
277
  socket.connect
265
278
  end
266
279
  else
@@ -302,6 +315,20 @@ module Faktory
302
315
 
303
316
  command("HELLO", Faktory.dump_json(payload))
304
317
  ok
318
+ rescue Errno::ECONNRESET, Faktory::TimeoutError
319
+ # A tcp client talking to a TLS server will get ECONNRESET
320
+ if tls?
321
+ raise
322
+ else
323
+ raise("Server using TLS? Use FAKTORY_URL=tcp+tls://... to enable encryption")
324
+ end
325
+ rescue *tlserrors
326
+ # A TLS client talking to a TCP server will get OpenSSL::SSL::SSLError
327
+ if tls?
328
+ raise("Server not using TLS? Use FAKTORY_URL=tcp://... to disable encryption")
329
+ else
330
+ raise
331
+ end
305
332
  end
306
333
 
307
334
  def command(*args)
@@ -317,11 +344,11 @@ module Faktory
317
344
  # have an underlying socket. Now if you disable testing and try to use that
318
345
  # client, it will crash without a socket. This open() handles that case to
319
346
  # transparently open a socket.
320
- open_socket(@timeout) if !@sock
347
+ open_socket if !@sock
321
348
 
322
349
  begin
323
350
  yield
324
- rescue SystemCallError, SocketError, TimeoutError
351
+ rescue SystemCallError, SocketError, Faktory::TimeoutError, OpenSSL::SSL::SSLError
325
352
  if retryable
326
353
  retryable = false
327
354
 
@@ -331,7 +358,7 @@ module Faktory
331
358
  nil
332
359
  end
333
360
  @sock = nil
334
- open_socket(@timeout)
361
+ open_socket
335
362
  retry
336
363
  else
337
364
  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.1"
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.1
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: []