job-iteration 1.8.0 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +1 -0
- data/CHANGELOG.md +6 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +100 -53
- data/lib/job-iteration/version.rb +1 -1
- data/lib/tapioca/dsl/compilers/job_iteration.rb +112 -0
- metadata +4 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b32eb2fd6eb2dc54f59eff462a3cde3882192134c2964ffc05b737957e3d4abb
|
4
|
+
data.tar.gz: 255864c2fac9d3cc0f75da1929d18c1aeb8e63ff83ea3dc6c19038c0e4894e54
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c241d626e4c92c4424dd08745feab35f1606fafbf6f0d610f34a704d16702a52623f646e5715925b331509257c737053b25bf90091f61a948b6fba2315cc659
|
7
|
+
data.tar.gz: 19b821e84f93954cea21b0709455ac5ad12b2633f70c2182ae93e75d2e883a0985dda1cf7c56ac89295caab1720ef3508857201d0c33f18b35ffad76996f093b
|
data/.github/workflows/ci.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -12,6 +12,12 @@ nil
|
|
12
12
|
|
13
13
|
nil
|
14
14
|
|
15
|
+
## v1.9.0 (Feb 3, 2024)
|
16
|
+
|
17
|
+
### Features
|
18
|
+
|
19
|
+
- [533](https://github.com/Shopify/job-iteration/pull/533) Added a custom compiler for [Tapioca](https://github.com/Shopify/tapioca) that generates Sorbet types for `MyJob.perform_later` if `MyJob` includes `JobIteration::Iteration` and has defined a type for `build_enumerator`.
|
20
|
+
|
15
21
|
## v1.8.0 (Dec 10, 2024)
|
16
22
|
|
17
23
|
### Changes
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
GIT
|
2
2
|
remote: https://github.com/brianmario/mysql2
|
3
|
-
revision:
|
3
|
+
revision: 57b8df188c963ae0e4d4e1123d3e9de2bbcab637
|
4
4
|
specs:
|
5
5
|
mysql2 (0.5.6)
|
6
6
|
bigdecimal
|
@@ -8,121 +8,166 @@ GIT
|
|
8
8
|
PATH
|
9
9
|
remote: .
|
10
10
|
specs:
|
11
|
-
job-iteration (1.
|
11
|
+
job-iteration (1.9.0)
|
12
12
|
activejob (>= 5.2)
|
13
13
|
|
14
14
|
GEM
|
15
15
|
remote: https://rubygems.org/
|
16
16
|
specs:
|
17
|
-
activejob (
|
18
|
-
activesupport (=
|
17
|
+
activejob (8.0.1)
|
18
|
+
activesupport (= 8.0.1)
|
19
19
|
globalid (>= 0.3.6)
|
20
|
-
activemodel (
|
21
|
-
activesupport (=
|
22
|
-
activerecord (
|
23
|
-
activemodel (=
|
24
|
-
activesupport (=
|
20
|
+
activemodel (8.0.1)
|
21
|
+
activesupport (= 8.0.1)
|
22
|
+
activerecord (8.0.1)
|
23
|
+
activemodel (= 8.0.1)
|
24
|
+
activesupport (= 8.0.1)
|
25
25
|
timeout (>= 0.4.0)
|
26
|
-
activesupport (
|
26
|
+
activesupport (8.0.1)
|
27
27
|
base64
|
28
|
+
benchmark (>= 0.3)
|
28
29
|
bigdecimal
|
29
|
-
concurrent-ruby (~> 1.0, >= 1.
|
30
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
30
31
|
connection_pool (>= 2.2.5)
|
31
32
|
drb
|
32
33
|
i18n (>= 1.6, < 2)
|
34
|
+
logger (>= 1.4.2)
|
33
35
|
minitest (>= 5.1)
|
34
|
-
|
35
|
-
tzinfo (~> 2.0)
|
36
|
+
securerandom (>= 0.3)
|
37
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
38
|
+
uri (>= 0.13.1)
|
36
39
|
ast (2.4.2)
|
37
40
|
base64 (0.2.0)
|
38
|
-
|
41
|
+
benchmark (0.4.0)
|
42
|
+
bigdecimal (3.1.9)
|
39
43
|
coderay (1.1.3)
|
40
|
-
concurrent-ruby (1.3.
|
41
|
-
connection_pool (2.
|
42
|
-
csv (3.3.
|
44
|
+
concurrent-ruby (1.3.5)
|
45
|
+
connection_pool (2.5.0)
|
46
|
+
csv (3.3.2)
|
43
47
|
drb (2.2.1)
|
48
|
+
erubi (1.13.1)
|
44
49
|
globalid (1.2.1)
|
45
50
|
activesupport (>= 6.1)
|
46
|
-
i18n (1.14.
|
51
|
+
i18n (1.14.7)
|
47
52
|
concurrent-ruby (~> 1.0)
|
48
|
-
json (2.
|
49
|
-
language_server-protocol (3.17.0.
|
53
|
+
json (2.9.1)
|
54
|
+
language_server-protocol (3.17.0.4)
|
55
|
+
logger (1.6.5)
|
50
56
|
method_source (1.1.0)
|
51
|
-
minitest (5.
|
52
|
-
mocha (2.7.
|
57
|
+
minitest (5.25.4)
|
58
|
+
mocha (2.7.1)
|
53
59
|
ruby2_keywords (>= 0.0.5)
|
54
60
|
mono_logger (1.1.2)
|
55
61
|
multi_json (1.15.0)
|
56
|
-
mustermann (3.0.
|
62
|
+
mustermann (3.0.3)
|
57
63
|
ruby2_keywords (~> 0.0.1)
|
58
|
-
|
59
|
-
parallel (1.
|
60
|
-
parser (3.3.
|
64
|
+
netrc (0.11.0)
|
65
|
+
parallel (1.26.3)
|
66
|
+
parser (3.3.7.0)
|
61
67
|
ast (~> 2.4.1)
|
62
68
|
racc
|
63
|
-
|
69
|
+
prism (1.3.0)
|
70
|
+
pry (0.15.2)
|
64
71
|
coderay (~> 1.1)
|
65
72
|
method_source (~> 1.0)
|
66
|
-
racc (1.8.
|
67
|
-
rack (3.1.
|
68
|
-
rack-protection (4.
|
73
|
+
racc (1.8.1)
|
74
|
+
rack (3.1.8)
|
75
|
+
rack-protection (4.1.1)
|
69
76
|
base64 (>= 0.1.0)
|
77
|
+
logger (>= 1.6.0)
|
70
78
|
rack (>= 3.0.0, < 4)
|
71
|
-
rack-session (2.
|
79
|
+
rack-session (2.1.0)
|
80
|
+
base64 (>= 0.1.0)
|
72
81
|
rack (>= 3.0.0)
|
73
82
|
rainbow (3.1.1)
|
74
83
|
rake (13.2.1)
|
84
|
+
rbi (0.2.4)
|
85
|
+
prism (~> 1.0)
|
86
|
+
sorbet-runtime (>= 0.5.9204)
|
75
87
|
redis (5.3.0)
|
76
88
|
redis-client (>= 0.22.0)
|
77
|
-
redis-client (0.
|
89
|
+
redis-client (0.23.2)
|
78
90
|
connection_pool
|
79
91
|
redis-namespace (1.11.0)
|
80
92
|
redis (>= 4)
|
81
|
-
regexp_parser (2.
|
82
|
-
resque (2.
|
83
|
-
mono_logger (~> 1
|
93
|
+
regexp_parser (2.10.0)
|
94
|
+
resque (2.7.0)
|
95
|
+
mono_logger (~> 1)
|
84
96
|
multi_json (~> 1.0)
|
85
97
|
redis-namespace (~> 1.6)
|
86
98
|
sinatra (>= 0.9.2)
|
87
|
-
|
88
|
-
rubocop (1.64.1)
|
99
|
+
rubocop (1.71.0)
|
89
100
|
json (~> 2.3)
|
90
101
|
language_server-protocol (>= 3.17.0)
|
91
102
|
parallel (~> 1.10)
|
92
103
|
parser (>= 3.3.0.2)
|
93
104
|
rainbow (>= 2.2.2, < 4.0)
|
94
|
-
regexp_parser (>=
|
95
|
-
|
96
|
-
rubocop-ast (>= 1.31.1, < 2.0)
|
105
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
106
|
+
rubocop-ast (>= 1.36.2, < 2.0)
|
97
107
|
ruby-progressbar (~> 1.7)
|
98
|
-
unicode-display_width (>= 2.4.0, <
|
99
|
-
rubocop-ast (1.
|
108
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
109
|
+
rubocop-ast (1.38.0)
|
100
110
|
parser (>= 3.3.1.0)
|
101
111
|
rubocop-shopify (2.15.1)
|
102
112
|
rubocop (~> 1.51)
|
103
113
|
ruby-progressbar (1.13.0)
|
104
114
|
ruby2_keywords (0.0.5)
|
105
|
-
|
106
|
-
|
115
|
+
securerandom (0.4.1)
|
116
|
+
sidekiq (7.3.8)
|
117
|
+
base64
|
107
118
|
connection_pool (>= 2.3.0)
|
119
|
+
logger
|
108
120
|
rack (>= 2.2.4)
|
109
|
-
redis-client (>= 0.
|
110
|
-
sinatra (4.
|
121
|
+
redis-client (>= 0.22.2)
|
122
|
+
sinatra (4.1.1)
|
123
|
+
logger (>= 1.6.0)
|
111
124
|
mustermann (~> 3.0)
|
112
125
|
rack (>= 3.0.0, < 4)
|
113
|
-
rack-protection (= 4.
|
126
|
+
rack-protection (= 4.1.1)
|
114
127
|
rack-session (>= 2.0.0, < 3)
|
115
128
|
tilt (~> 2.0)
|
116
|
-
sorbet
|
117
|
-
|
118
|
-
|
129
|
+
sorbet (0.5.11787)
|
130
|
+
sorbet-static (= 0.5.11787)
|
131
|
+
sorbet-runtime (0.5.11787)
|
132
|
+
sorbet-static (0.5.11787-universal-darwin)
|
133
|
+
sorbet-static (0.5.11787-x86_64-linux)
|
134
|
+
sorbet-static-and-runtime (0.5.11787)
|
135
|
+
sorbet (= 0.5.11787)
|
136
|
+
sorbet-runtime (= 0.5.11787)
|
137
|
+
spoom (1.5.2)
|
138
|
+
erubi (>= 1.10.0)
|
139
|
+
prism (>= 0.28.0)
|
140
|
+
rbi (>= 0.2.3)
|
141
|
+
sorbet-static-and-runtime (>= 0.5.10187)
|
142
|
+
thor (>= 0.19.2)
|
143
|
+
tapioca (0.16.8)
|
144
|
+
benchmark
|
145
|
+
bundler (>= 2.2.25)
|
146
|
+
netrc (>= 0.11.0)
|
147
|
+
parallel (>= 1.21.0)
|
148
|
+
rbi (~> 0.2)
|
149
|
+
sorbet-static-and-runtime (>= 0.5.11087)
|
150
|
+
spoom (>= 1.2.0)
|
151
|
+
thor (>= 1.2.0)
|
152
|
+
yard-sorbet
|
153
|
+
thor (1.3.2)
|
154
|
+
tilt (2.6.0)
|
155
|
+
timeout (0.4.3)
|
119
156
|
tzinfo (2.0.6)
|
120
157
|
concurrent-ruby (~> 1.0)
|
121
|
-
unicode-display_width (
|
158
|
+
unicode-display_width (3.1.4)
|
159
|
+
unicode-emoji (~> 4.0, >= 4.0.4)
|
160
|
+
unicode-emoji (4.0.4)
|
161
|
+
uri (1.0.2)
|
122
162
|
yard (0.9.37)
|
163
|
+
yard-sorbet (0.9.0)
|
164
|
+
sorbet-runtime
|
165
|
+
yard
|
123
166
|
|
124
167
|
PLATFORMS
|
125
|
-
|
168
|
+
arm64-darwin
|
169
|
+
x86_64-darwin
|
170
|
+
x86_64-linux
|
126
171
|
|
127
172
|
DEPENDENCIES
|
128
173
|
activerecord
|
@@ -130,6 +175,7 @@ DEPENDENCIES
|
|
130
175
|
globalid
|
131
176
|
i18n
|
132
177
|
job-iteration!
|
178
|
+
logger
|
133
179
|
mocha
|
134
180
|
mysql2!
|
135
181
|
pry
|
@@ -139,7 +185,8 @@ DEPENDENCIES
|
|
139
185
|
rubocop-shopify
|
140
186
|
sidekiq
|
141
187
|
sorbet-runtime
|
188
|
+
tapioca
|
142
189
|
yard
|
143
190
|
|
144
191
|
BUNDLED WITH
|
145
|
-
2.
|
192
|
+
2.6.1
|
@@ -0,0 +1,112 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
return unless defined?(JobIteration::Iteration)
|
5
|
+
|
6
|
+
module Tapioca
|
7
|
+
module Dsl
|
8
|
+
module Compilers
|
9
|
+
class JobIteration < Compiler
|
10
|
+
extend T::Sig
|
11
|
+
|
12
|
+
ConstantType = type_member { { fixed: T.class_of(::JobIteration::Iteration) } }
|
13
|
+
PARAM_TYPES_IN_ORDER = [
|
14
|
+
RBI::Param,
|
15
|
+
RBI::OptParam,
|
16
|
+
RBI::RestParam,
|
17
|
+
RBI::KwParam,
|
18
|
+
RBI::KwOptParam,
|
19
|
+
RBI::KwRestParam,
|
20
|
+
RBI::BlockParam,
|
21
|
+
].freeze
|
22
|
+
|
23
|
+
sig { override.void }
|
24
|
+
def decorate
|
25
|
+
return unless constant.instance_methods(false).include?(:build_enumerator)
|
26
|
+
|
27
|
+
root.create_path(constant) do |job|
|
28
|
+
method = constant.instance_method(:build_enumerator)
|
29
|
+
constant_name = name_of(constant)
|
30
|
+
signature = signature_of(method)
|
31
|
+
|
32
|
+
parameters = compile_method_parameters_to_rbi(method).reject do |typed_param|
|
33
|
+
typed_param.param.name == "cursor"
|
34
|
+
end
|
35
|
+
|
36
|
+
if signature
|
37
|
+
fixed_hash_args = signature.arg_types.select { |arg_type| T::Types::FixedHash === arg_type[1] }.to_h
|
38
|
+
expanded_parameters = parameters.flat_map do |typed_param|
|
39
|
+
if (hash_type = fixed_hash_args[typed_param.param.name.to_sym])
|
40
|
+
hash_type.types.map do |key, value|
|
41
|
+
if value.name.start_with?("T.nilable")
|
42
|
+
create_kw_opt_param(key.to_s, type: value.to_s, default: "nil")
|
43
|
+
else
|
44
|
+
create_kw_param(key.to_s, type: value.to_s)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
else
|
48
|
+
typed_param
|
49
|
+
end
|
50
|
+
end
|
51
|
+
else
|
52
|
+
expanded_parameters = parameters
|
53
|
+
end
|
54
|
+
|
55
|
+
# Sorbet expects optional keyword arguments to be after required keyword arguments.
|
56
|
+
expanded_parameters.sort_by! { |typed_param| PARAM_TYPES_IN_ORDER.index(typed_param.param.class) }
|
57
|
+
|
58
|
+
job.create_method(
|
59
|
+
"perform_later",
|
60
|
+
parameters: perform_later_parameters(expanded_parameters, constant_name),
|
61
|
+
return_type: "T.any(#{constant_name}, FalseClass)",
|
62
|
+
class_method: true,
|
63
|
+
)
|
64
|
+
|
65
|
+
job.create_method(
|
66
|
+
"perform_now",
|
67
|
+
parameters: expanded_parameters,
|
68
|
+
return_type: "T.any(NilClass, Exception)",
|
69
|
+
class_method: true,
|
70
|
+
)
|
71
|
+
|
72
|
+
job.create_method(
|
73
|
+
"perform",
|
74
|
+
parameters: expanded_parameters,
|
75
|
+
return_type: "void",
|
76
|
+
class_method: false,
|
77
|
+
)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
private
|
82
|
+
|
83
|
+
sig do
|
84
|
+
params(
|
85
|
+
parameters: T::Array[RBI::TypedParam],
|
86
|
+
constant_name: T.nilable(String),
|
87
|
+
).returns(T::Array[RBI::TypedParam])
|
88
|
+
end
|
89
|
+
def perform_later_parameters(parameters, constant_name)
|
90
|
+
if ::Gem::Requirement.new(">= 7.0").satisfied_by?(::ActiveJob.gem_version)
|
91
|
+
parameters.reject! { |typed_param| RBI::BlockParam === typed_param.param }
|
92
|
+
parameters + [create_block_param(
|
93
|
+
"block",
|
94
|
+
type: "T.nilable(T.proc.params(job: #{constant_name}).void)",
|
95
|
+
)]
|
96
|
+
else
|
97
|
+
parameters
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
class << self
|
102
|
+
extend T::Sig
|
103
|
+
|
104
|
+
sig { override.returns(T::Enumerable[Module]) }
|
105
|
+
def gather_constants
|
106
|
+
all_classes.select { |c| ::JobIteration::Iteration > c }
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: job-iteration
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-02-03 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: activejob
|
@@ -75,13 +74,13 @@ files:
|
|
75
74
|
- lib/job-iteration/test_helper.rb
|
76
75
|
- lib/job-iteration/throttle_enumerator.rb
|
77
76
|
- lib/job-iteration/version.rb
|
77
|
+
- lib/tapioca/dsl/compilers/job_iteration.rb
|
78
78
|
homepage: https://github.com/shopify/job-iteration
|
79
79
|
licenses:
|
80
80
|
- MIT
|
81
81
|
metadata:
|
82
82
|
changelog_uri: https://github.com/Shopify/job-iteration/blob/main/CHANGELOG.md
|
83
83
|
allowed_push_host: https://rubygems.org
|
84
|
-
post_install_message:
|
85
84
|
rdoc_options: []
|
86
85
|
require_paths:
|
87
86
|
- lib
|
@@ -96,8 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
95
|
- !ruby/object:Gem::Version
|
97
96
|
version: '0'
|
98
97
|
requirements: []
|
99
|
-
rubygems_version: 3.
|
100
|
-
signing_key:
|
98
|
+
rubygems_version: 3.6.3
|
101
99
|
specification_version: 4
|
102
100
|
summary: Makes your background jobs interruptible and resumable.
|
103
101
|
test_files: []
|