faktory_worker_ruby 1.2.0 → 1.3.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/.standard.yml +3 -6
- data/Changes.md +6 -0
- data/Gemfile.lock +20 -20
- data/bin/faktory-worker +3 -3
- data/lib/faktory/batch.rb +4 -0
- data/lib/faktory/client.rb +3 -0
- data/lib/faktory/job.rb +15 -0
- data/lib/faktory/job_logger.rb +1 -1
- data/lib/faktory/processor.rb +3 -2
- data/lib/faktory/testing.rb +3 -3
- data/lib/faktory/util.rb +1 -1
- data/lib/faktory/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: abc45bf7c07e61197705a9283c38e6d399a81701f433d8a5eded1e6cb6b480e3
|
4
|
+
data.tar.gz: ac96de6c442ad806cf3cafa5fc839e5509454a8f315229f4014cddfcd9bbb28e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef6262279803c776c204d2efd58bb547617519bf8277a78e3a46f3789e39bff21220134556f8c209b3d7fd26eb85627b24062f721de3c87324acb0063ec778e4
|
7
|
+
data.tar.gz: 6de7bd208b4ab94ab57b3513159c5ab047f5144fb6152365d52535e3274f8306a416a1124f1c299fe0269542bdb61670958323b8be2285face085f8e3f53ae35
|
data/.standard.yml
CHANGED
@@ -2,11 +2,8 @@ ruby_version: 2.5.0
|
|
2
2
|
fix: true
|
3
3
|
parallel: true
|
4
4
|
ignore:
|
5
|
-
- test/**/*
|
6
|
-
- examples/**/*
|
7
|
-
- myapp/**/*
|
8
|
-
- 'lib/faktory.rb':
|
9
|
-
- Lint/InheritException
|
10
5
|
- 'lib/**/*':
|
11
|
-
-
|
6
|
+
- Style/GlobalVars
|
7
|
+
- 'test/**/*':
|
8
|
+
- Lint/ConstantDefinitionInBlock
|
12
9
|
- Style/GlobalVars
|
data/Changes.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,23 +1,23 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
faktory_worker_ruby (1.
|
4
|
+
faktory_worker_ruby (1.3.0)
|
5
5
|
connection_pool (~> 2.2, >= 2.2.2)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activejob (7.0.4.
|
11
|
-
activesupport (= 7.0.4.
|
10
|
+
activejob (7.0.4.3)
|
11
|
+
activesupport (= 7.0.4.3)
|
12
12
|
globalid (>= 0.3.6)
|
13
|
-
activesupport (7.0.4.
|
13
|
+
activesupport (7.0.4.3)
|
14
14
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
15
15
|
i18n (>= 1.6, < 2)
|
16
16
|
minitest (>= 5.1)
|
17
17
|
tzinfo (~> 2.0)
|
18
18
|
ast (2.4.2)
|
19
|
-
concurrent-ruby (1.2.
|
20
|
-
connection_pool (2.
|
19
|
+
concurrent-ruby (1.2.2)
|
20
|
+
connection_pool (2.4.0)
|
21
21
|
docile (1.4.0)
|
22
22
|
globalid (1.1.0)
|
23
23
|
activesupport (>= 5.0)
|
@@ -25,42 +25,42 @@ GEM
|
|
25
25
|
concurrent-ruby (~> 1.0)
|
26
26
|
json (2.6.3)
|
27
27
|
language_server-protocol (3.17.0.3)
|
28
|
-
minitest (5.
|
28
|
+
minitest (5.18.0)
|
29
29
|
minitest-hooks (1.5.0)
|
30
30
|
minitest (> 5.3)
|
31
31
|
parallel (1.22.1)
|
32
|
-
parser (3.2.
|
32
|
+
parser (3.2.2.0)
|
33
33
|
ast (~> 2.4.1)
|
34
34
|
rainbow (3.1.1)
|
35
35
|
rake (13.0.6)
|
36
|
-
regexp_parser (2.
|
36
|
+
regexp_parser (2.7.0)
|
37
37
|
rexml (3.2.5)
|
38
|
-
rubocop (1.
|
38
|
+
rubocop (1.48.1)
|
39
39
|
json (~> 2.3)
|
40
40
|
parallel (~> 1.10)
|
41
|
-
parser (>= 3.
|
41
|
+
parser (>= 3.2.0.0)
|
42
42
|
rainbow (>= 2.2.2, < 4.0)
|
43
43
|
regexp_parser (>= 1.8, < 3.0)
|
44
44
|
rexml (>= 3.2.5, < 4.0)
|
45
|
-
rubocop-ast (>= 1.
|
45
|
+
rubocop-ast (>= 1.26.0, < 2.0)
|
46
46
|
ruby-progressbar (~> 1.7)
|
47
|
-
unicode-display_width (>=
|
48
|
-
rubocop-ast (1.
|
49
|
-
parser (>= 3.
|
50
|
-
rubocop-performance (1.
|
47
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
48
|
+
rubocop-ast (1.28.0)
|
49
|
+
parser (>= 3.2.1.0)
|
50
|
+
rubocop-performance (1.16.0)
|
51
51
|
rubocop (>= 1.7.0, < 2.0)
|
52
52
|
rubocop-ast (>= 0.4.0)
|
53
|
-
ruby-progressbar (1.
|
53
|
+
ruby-progressbar (1.13.0)
|
54
54
|
simplecov (0.22.0)
|
55
55
|
docile (~> 1.1)
|
56
56
|
simplecov-html (~> 0.11)
|
57
57
|
simplecov_json_formatter (~> 0.1)
|
58
58
|
simplecov-html (0.12.3)
|
59
59
|
simplecov_json_formatter (0.1.4)
|
60
|
-
standard (1.
|
60
|
+
standard (1.25.3)
|
61
61
|
language_server-protocol (~> 3.17.0.2)
|
62
|
-
rubocop (
|
63
|
-
rubocop-performance (
|
62
|
+
rubocop (~> 1.48.1)
|
63
|
+
rubocop-performance (~> 1.16.0)
|
64
64
|
tzinfo (2.0.6)
|
65
65
|
concurrent-ruby (~> 1.0)
|
66
66
|
unicode-display_width (2.4.2)
|
data/bin/faktory-worker
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
# RUBYOPT=-w bundle exec faktory
|
5
5
|
$TESTING = false
|
6
6
|
|
7
|
-
require_relative
|
7
|
+
require_relative "../lib/faktory/cli"
|
8
8
|
|
9
9
|
begin
|
10
10
|
cli = Faktory::CLI.instance
|
@@ -12,7 +12,7 @@ begin
|
|
12
12
|
cli.run
|
13
13
|
rescue => e
|
14
14
|
raise e if $DEBUG
|
15
|
-
|
16
|
-
|
15
|
+
warn e.message
|
16
|
+
warn e.backtrace.join("\n")
|
17
17
|
exit 1
|
18
18
|
end
|
data/lib/faktory/batch.rb
CHANGED
data/lib/faktory/client.rb
CHANGED
@@ -163,7 +163,9 @@ module Faktory
|
|
163
163
|
# Hash must contain "jid", "jobtype" and "args" elements at minimum.
|
164
164
|
# Returned value will either be the JID String if successful OR
|
165
165
|
# a symbol corresponding to an error.
|
166
|
+
# NB: aliased by faktory/testing
|
166
167
|
def push(job)
|
168
|
+
job = job.transform_keys(&:to_s)
|
167
169
|
job["jid"] ||= SecureRandom.hex(12)
|
168
170
|
job["queue"] ||= "default"
|
169
171
|
raise ArgumentError, "Missing `jobtype` attribute: #{job.inspect}" unless job["jobtype"]
|
@@ -246,6 +248,7 @@ module Faktory
|
|
246
248
|
@location.scheme =~ /tls/
|
247
249
|
end
|
248
250
|
|
251
|
+
# NB: aliased by faktory/testing
|
249
252
|
def open_socket(timeout = DEFAULT_TIMEOUT)
|
250
253
|
if tls?
|
251
254
|
require "openssl"
|
data/lib/faktory/job.rb
CHANGED
@@ -23,6 +23,7 @@ module Faktory
|
|
23
23
|
module Job
|
24
24
|
attr_accessor :jid
|
25
25
|
attr_accessor :bid
|
26
|
+
attr_accessor :_custom
|
26
27
|
|
27
28
|
include Faktory::Trackable
|
28
29
|
|
@@ -37,12 +38,26 @@ module Faktory
|
|
37
38
|
Setter.new(options)
|
38
39
|
end
|
39
40
|
|
41
|
+
# this method is typically called within a batch job to reopen
|
42
|
+
# the batch in order to add more jobs.
|
40
43
|
def batch
|
41
44
|
if bid
|
42
45
|
@batch ||= Faktory::Batch.new(bid)
|
43
46
|
end
|
44
47
|
end
|
45
48
|
|
49
|
+
# this method is typically called within a child batch callback to reopen
|
50
|
+
# the parent batch in order to add more jobs or workflow steps.
|
51
|
+
def parent_batch
|
52
|
+
if parent_bid
|
53
|
+
@parent_batch ||= Faktory::Batch.new(parent_bid)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def parent_bid
|
58
|
+
_custom["_pbid"]
|
59
|
+
end
|
60
|
+
|
46
61
|
def logger
|
47
62
|
Faktory.logger
|
48
63
|
end
|
data/lib/faktory/job_logger.rb
CHANGED
data/lib/faktory/processor.rb
CHANGED
@@ -73,7 +73,7 @@ module Faktory
|
|
73
73
|
@mgr.processor_stopped(self)
|
74
74
|
rescue Faktory::Shutdown
|
75
75
|
@mgr.processor_stopped(self)
|
76
|
-
rescue Exception => ex
|
76
|
+
rescue Exception => ex # rubocop:disable Lint/RescueException
|
77
77
|
@mgr.processor_died(self, ex)
|
78
78
|
end
|
79
79
|
|
@@ -131,6 +131,7 @@ module Faktory
|
|
131
131
|
klass = constantize(payload["jobtype"])
|
132
132
|
jobinst = klass.new
|
133
133
|
jobinst.jid = payload["jid"]
|
134
|
+
jobinst._custom = payload["custom"]
|
134
135
|
yield jobinst
|
135
136
|
end
|
136
137
|
end
|
@@ -151,7 +152,7 @@ module Faktory
|
|
151
152
|
# the timeout. Fail it so we can release any locks server-side
|
152
153
|
# and immediately restart it.
|
153
154
|
work.fail(shut)
|
154
|
-
rescue Exception => ex
|
155
|
+
rescue Exception => ex # rubocop:disable Lint/RescueException
|
155
156
|
handle_exception(ex, {context: "Job raised exception", job: work.job})
|
156
157
|
work.fail(ex)
|
157
158
|
raise ex
|
data/lib/faktory/testing.rb
CHANGED
@@ -76,7 +76,7 @@ module Faktory
|
|
76
76
|
|
77
77
|
class Client
|
78
78
|
alias_method :real_push, :push
|
79
|
-
alias_method :
|
79
|
+
alias_method :real_open_socket, :open_socket
|
80
80
|
|
81
81
|
def push(job)
|
82
82
|
if Faktory::Testing.inline?
|
@@ -94,9 +94,9 @@ module Faktory
|
|
94
94
|
end
|
95
95
|
end
|
96
96
|
|
97
|
-
def
|
97
|
+
def open_socket(*args)
|
98
98
|
unless Faktory::Testing.enabled?
|
99
|
-
|
99
|
+
real_open_socket(*args)
|
100
100
|
end
|
101
101
|
end
|
102
102
|
end
|
data/lib/faktory/util.rb
CHANGED
data/lib/faktory/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: faktory_worker_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Perham
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: connection_pool
|
@@ -154,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
154
154
|
- !ruby/object:Gem::Version
|
155
155
|
version: '0'
|
156
156
|
requirements: []
|
157
|
-
rubygems_version: 3.4.
|
157
|
+
rubygems_version: 3.4.7
|
158
158
|
signing_key:
|
159
159
|
specification_version: 4
|
160
160
|
summary: Ruby worker for Faktory
|