faktory_worker_ruby 1.3.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 +4 -4
- data/.github/workflows/ci.yml +1 -1
- data/.standard.yml +1 -1
- data/Changes.md +12 -0
- data/Gemfile.lock +73 -39
- data/README.md +5 -5
- data/faktory_worker_ruby.gemspec +3 -3
- data/lib/faktory/client.rb +30 -12
- data/lib/faktory/connection.rb +1 -1
- data/lib/faktory/io.rb +1 -0
- data/lib/faktory/job.rb +1 -1
- data/lib/faktory/logging.rb +1 -1
- data/lib/faktory/rails.rb +3 -3
- data/lib/faktory/version.rb +1 -1
- metadata +8 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: effc5e0683ad3dda06516e048c0855a9a7eabfeac799bc20340a01ea181c531e
|
4
|
+
data.tar.gz: 76e824912d51ac9e9d53f8971076d8155dbb4c74448a3f47bdbba663bb824f9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24a4d33c1eb0b81ed82664d2b1ad4b8f3c0a608f49b567f89adfbed85bd2bdfc2d667b2745a997229cda9c06b81b19d552b5a852dc6ea70b563bf61e176b8819
|
7
|
+
data.tar.gz: 6fa8af5d29d4eede89e51ef35be4a9e789a677518655e592a5c6ad95ab495e62443cd9a9b837cb88dba7f1b14aa326b1eec14eb0223c4ba9184093fb181fb5c3
|
data/.github/workflows/ci.yml
CHANGED
data/.standard.yml
CHANGED
data/Changes.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Changes
|
2
2
|
|
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
|
10
|
+
|
11
|
+
- Allow more connections in pool [#455]
|
12
|
+
- Minimum Ruby version is now 2.7.
|
13
|
+
- Minimum Rails version is now 6.0.
|
14
|
+
|
3
15
|
## 1.3.0
|
4
16
|
|
5
17
|
- Fix `faktory/testing` [#74]
|
data/Gemfile.lock
CHANGED
@@ -1,69 +1,100 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
faktory_worker_ruby (1.
|
5
|
-
connection_pool (~> 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 (
|
11
|
-
activesupport (=
|
10
|
+
activejob (8.0.2)
|
11
|
+
activesupport (= 8.0.2)
|
12
12
|
globalid (>= 0.3.6)
|
13
|
-
activesupport (
|
14
|
-
|
13
|
+
activesupport (8.0.2)
|
14
|
+
base64
|
15
|
+
benchmark (>= 0.3)
|
16
|
+
bigdecimal
|
17
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
18
|
+
connection_pool (>= 2.2.5)
|
19
|
+
drb
|
15
20
|
i18n (>= 1.6, < 2)
|
21
|
+
logger (>= 1.4.2)
|
16
22
|
minitest (>= 5.1)
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
23
|
+
securerandom (>= 0.3)
|
24
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
25
|
+
uri (>= 0.13.1)
|
26
|
+
ast (2.4.3)
|
27
|
+
base64 (0.2.0)
|
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)
|
34
|
+
globalid (1.2.1)
|
35
|
+
activesupport (>= 6.1)
|
36
|
+
i18n (1.14.7)
|
25
37
|
concurrent-ruby (~> 1.0)
|
26
|
-
json (2.
|
27
|
-
language_server-protocol (3.17.0.
|
28
|
-
|
29
|
-
|
38
|
+
json (2.11.3)
|
39
|
+
language_server-protocol (3.17.0.4)
|
40
|
+
lint_roller (1.1.0)
|
41
|
+
logger (1.7.0)
|
42
|
+
minitest (5.25.5)
|
43
|
+
minitest-hooks (1.5.2)
|
30
44
|
minitest (> 5.3)
|
31
|
-
parallel (1.
|
32
|
-
parser (3.
|
45
|
+
parallel (1.27.0)
|
46
|
+
parser (3.3.8.0)
|
33
47
|
ast (~> 2.4.1)
|
48
|
+
racc
|
49
|
+
prism (1.4.0)
|
50
|
+
racc (1.8.1)
|
34
51
|
rainbow (3.1.1)
|
35
|
-
rake (13.
|
36
|
-
regexp_parser (2.
|
37
|
-
|
38
|
-
rubocop (1.48.1)
|
52
|
+
rake (13.2.1)
|
53
|
+
regexp_parser (2.10.0)
|
54
|
+
rubocop (1.75.5)
|
39
55
|
json (~> 2.3)
|
56
|
+
language_server-protocol (~> 3.17.0.2)
|
57
|
+
lint_roller (~> 1.1.0)
|
40
58
|
parallel (~> 1.10)
|
41
|
-
parser (>= 3.
|
59
|
+
parser (>= 3.3.0.2)
|
42
60
|
rainbow (>= 2.2.2, < 4.0)
|
43
|
-
regexp_parser (>=
|
44
|
-
|
45
|
-
rubocop-ast (>= 1.26.0, < 2.0)
|
61
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
62
|
+
rubocop-ast (>= 1.44.0, < 2.0)
|
46
63
|
ruby-progressbar (~> 1.7)
|
47
|
-
unicode-display_width (>= 2.4.0, <
|
48
|
-
rubocop-ast (1.
|
49
|
-
parser (>= 3.
|
50
|
-
|
51
|
-
|
52
|
-
|
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)
|
53
72
|
ruby-progressbar (1.13.0)
|
73
|
+
securerandom (0.4.1)
|
54
74
|
simplecov (0.22.0)
|
55
75
|
docile (~> 1.1)
|
56
76
|
simplecov-html (~> 0.11)
|
57
77
|
simplecov_json_formatter (~> 0.1)
|
58
|
-
simplecov-html (0.
|
78
|
+
simplecov-html (0.13.1)
|
59
79
|
simplecov_json_formatter (0.1.4)
|
60
|
-
standard (1.
|
80
|
+
standard (1.49.0)
|
61
81
|
language_server-protocol (~> 3.17.0.2)
|
62
|
-
|
63
|
-
rubocop
|
82
|
+
lint_roller (~> 1.0)
|
83
|
+
rubocop (~> 1.75.2)
|
84
|
+
standard-custom (~> 1.0.0)
|
85
|
+
standard-performance (~> 1.8)
|
86
|
+
standard-custom (1.0.2)
|
87
|
+
lint_roller (~> 1.0)
|
88
|
+
rubocop (~> 1.50)
|
89
|
+
standard-performance (1.8.0)
|
90
|
+
lint_roller (~> 1.1)
|
91
|
+
rubocop-performance (~> 1.25.0)
|
64
92
|
tzinfo (2.0.6)
|
65
93
|
concurrent-ruby (~> 1.0)
|
66
|
-
unicode-display_width (
|
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)
|
67
98
|
|
68
99
|
PLATFORMS
|
69
100
|
ruby
|
@@ -76,3 +107,6 @@ DEPENDENCIES
|
|
76
107
|
rake
|
77
108
|
simplecov
|
78
109
|
standard
|
110
|
+
|
111
|
+
BUNDLED WITH
|
112
|
+
2.4.22
|
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.
|
38
|
-
* Faktory 1.
|
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
|
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
|
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
|
data/faktory_worker_ruby.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |gem|
|
|
12
12
|
gem.executables = ["faktory-worker"]
|
13
13
|
gem.files = `git ls-files | grep -Ev '^(test|myapp|examples)'`.split("\n")
|
14
14
|
gem.version = Faktory::VERSION
|
15
|
-
gem.required_ruby_version = ">= 2.
|
15
|
+
gem.required_ruby_version = ">= 2.7.0"
|
16
16
|
|
17
17
|
gem.metadata = {
|
18
18
|
"homepage_uri" => "https://contribsys.com/faktory",
|
@@ -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.
|
26
|
-
gem.add_development_dependency "activejob", ">=
|
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"
|
data/lib/faktory/client.rb
CHANGED
@@ -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
|
-
@
|
57
|
+
@sock = nil
|
59
58
|
|
60
|
-
open_socket
|
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
|
-
|
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
|
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
|
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
|
352
|
+
open_socket
|
335
353
|
retry
|
336
354
|
else
|
337
355
|
raise
|
@@ -347,9 +365,9 @@ module Faktory
|
|
347
365
|
raise Errno::ECONNRESET, "No response" unless line
|
348
366
|
chr = line[0]
|
349
367
|
if chr == "+"
|
350
|
-
line[1
|
368
|
+
line[1..].strip
|
351
369
|
elsif chr == "$"
|
352
|
-
count = line[1
|
370
|
+
count = line[1..].strip.to_i
|
353
371
|
return nil if count == -1
|
354
372
|
data = read(count) if count > 0
|
355
373
|
_ = gets # read extra linefeeds
|
@@ -362,7 +380,7 @@ module Faktory
|
|
362
380
|
#
|
363
381
|
# -NOTUNIQUE Job not unique
|
364
382
|
# We return ["NOTUNIQUE", "Job not unique"]
|
365
|
-
err = line[1
|
383
|
+
err = line[1..].split(" ", 2)
|
366
384
|
raise CommandError, err[1] if err[0] == "ERR"
|
367
385
|
err
|
368
386
|
else
|
data/lib/faktory/connection.rb
CHANGED
@@ -6,7 +6,7 @@ module Faktory
|
|
6
6
|
class Connection
|
7
7
|
class << self
|
8
8
|
def create(options = {})
|
9
|
-
size = Faktory.worker? ? (Faktory.options[:concurrency] +
|
9
|
+
size = Faktory.worker? ? (Faktory.options[:concurrency] + 5) : 20
|
10
10
|
ConnectionPool.new(timeout: options[:pool_timeout] || 1, size: size) do
|
11
11
|
Faktory::Client.new(**options)
|
12
12
|
end
|
data/lib/faktory/io.rb
CHANGED
data/lib/faktory/job.rb
CHANGED
@@ -173,7 +173,7 @@ module Faktory
|
|
173
173
|
m = "#{name}="
|
174
174
|
undef_method(m) if method_defined?(m) || private_method_defined?(m)
|
175
175
|
end
|
176
|
-
define_singleton_method("#{name}=") do |val|
|
176
|
+
define_singleton_method(:"#{name}=") do |val|
|
177
177
|
singleton_class.class_eval do
|
178
178
|
undef_method(name) if method_defined?(name) || private_method_defined?(name)
|
179
179
|
define_method(name) { val }
|
data/lib/faktory/logging.rb
CHANGED
data/lib/faktory/rails.rb
CHANGED
@@ -22,7 +22,7 @@ module Faktory
|
|
22
22
|
# None of this matters on the client-side, only within the Faktory executor itself.
|
23
23
|
#
|
24
24
|
Faktory.configure_worker do |_|
|
25
|
-
if ::Rails::VERSION::MAJOR <
|
25
|
+
if ::Rails::VERSION::MAJOR < 6
|
26
26
|
raise "Your current version of Rails, #{::Rails::VERSION::STRING}, is not supported"
|
27
27
|
end
|
28
28
|
|
@@ -58,9 +58,9 @@ module Faktory
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
-
if defined?(::Rails) && ::Rails::VERSION::MAJOR <
|
61
|
+
if defined?(::Rails) && ::Rails::VERSION::MAJOR < 6
|
62
62
|
warn("**************************************************")
|
63
|
-
warn("🚫 ERROR: Faktory Worker does not support Rails
|
63
|
+
warn("🚫 ERROR: Faktory Worker does not support Rails version < 6.x")
|
64
64
|
warn("**************************************************")
|
65
65
|
warn("")
|
66
66
|
end
|
data/lib/faktory/version.rb
CHANGED
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: 1.
|
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:
|
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.
|
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.
|
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:
|
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:
|
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
|
@@ -147,15 +139,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
147
139
|
requirements:
|
148
140
|
- - ">="
|
149
141
|
- !ruby/object:Gem::Version
|
150
|
-
version: 2.
|
142
|
+
version: 2.7.0
|
151
143
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
144
|
requirements:
|
153
145
|
- - ">="
|
154
146
|
- !ruby/object:Gem::Version
|
155
147
|
version: '0'
|
156
148
|
requirements: []
|
157
|
-
rubygems_version: 3.
|
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: []
|