File tree 4 files changed +21
-5
lines changed
app/jobs/concerns/maintenance_tasks
test/jobs/maintenance_tasks
4 files changed +21
-5
lines changed Original file line number Diff line number Diff line change 5
5
actionpack (>= 6.0 )
6
6
activejob (>= 6.0 )
7
7
activerecord (>= 6.0 )
8
- job-iteration (~> 1.1 )
8
+ job-iteration (~> 1.3.6 )
9
9
railties (>= 6.0 )
10
10
11
11
GEM
98
98
erubi (1.10.0 )
99
99
globalid (1.0.0 )
100
100
activesupport (>= 5.0 )
101
- i18n (1.9.1 )
101
+ i18n (1.10.0 )
102
102
concurrent-ruby (~> 1.0 )
103
103
io-wait (0.2.1 )
104
- job-iteration (1.3.5 )
104
+ job-iteration (1.3.6 )
105
105
activejob (>= 5.2 )
106
106
loofah (2.14.0 )
107
107
crass (~> 1.0.2 )
Original file line number Diff line number Diff line change @@ -152,7 +152,7 @@ def reenqueue_iteration_job(should_ignore: true)
152
152
def after_perform
153
153
@run . persist_transition
154
154
if defined? ( @reenqueue_iteration_job ) && @reenqueue_iteration_job
155
- reenqueue_iteration_job ( should_ignore : false )
155
+ reenqueue_iteration_job ( should_ignore : false ) unless @run . stopped?
156
156
end
157
157
end
158
158
Original file line number Diff line number Diff line change @@ -22,6 +22,6 @@ Gem::Specification.new do |spec|
22
22
spec . add_dependency ( "actionpack" , ">= 6.0" )
23
23
spec . add_dependency ( "activejob" , ">= 6.0" )
24
24
spec . add_dependency ( "activerecord" , ">= 6.0" )
25
- spec . add_dependency ( "job-iteration" , "~> 1.1 " )
25
+ spec . add_dependency ( "job-iteration" , "~> 1.3.6 " )
26
26
spec . add_dependency ( "railties" , ">= 6.0" )
27
27
end
Original file line number Diff line number Diff line change @@ -407,6 +407,22 @@ class << self
407
407
assert_predicate run . reload , :succeeded?
408
408
end
409
409
410
+ test ".perform_now with a throttle doesn't enqueue a job if run is stopping" do
411
+ run = Run . create! ( task_name : "Maintenance::UpdatePostsThrottledTask" )
412
+ Maintenance ::UpdatePostsThrottledTask . any_instance
413
+ . expects ( :process ) . once . with do
414
+ run . cancelling!
415
+ Maintenance ::UpdatePostsThrottledTask . throttle = true
416
+ end
417
+
418
+ TaskJob . perform_now ( run )
419
+
420
+ assert_predicate ( run . reload , :cancelled? )
421
+ assert_empty ( enqueued_jobs )
422
+ ensure
423
+ Maintenance ::UpdatePostsThrottledTask . throttle = false
424
+ end
425
+
410
426
test ".perform_now makes arguments supplied for Task parameters available" do
411
427
post = Post . last
412
428
Maintenance ::ParamsTask . any_instance . expects ( :process ) . once . with ( post )
You can’t perform that action at this time.
0 commit comments