Skip to content

Commit e43069d

Browse files
Merge pull request #174 from Shopify/remove-unnecessary-transition
Remove unnecessary transition pausing -> interrupted
2 parents f1f8927 + 00877fa commit e43069d

File tree

2 files changed

+3
-13
lines changed

2 files changed

+3
-13
lines changed

app/validators/maintenance_tasks/run_status_validator.rb

+1-3
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,13 @@ class RunStatusValidator < ActiveModel::Validator
1414
'enqueued' => ['running', 'pausing', 'cancelling'],
1515
# pausing -> paused occurs when the task actually halts performing and
1616
# occupies a status of paused.
17-
# pausing -> interrupted occurs when the job infra shuts down the task
18-
# after it was paused by the user, but before performing halted.
1917
# pausing -> cancelling occurs when the user cancels a task immediately
2018
# after it was paused, such that the task had not actually halted yet.
2119
# pausing -> succeeded occurs when the task completes immediately after
2220
# being paused. This can happen if the task is on its last iteration
2321
# when it is paused, or if the task is paused after enqueue but has
2422
# nothing in its collection to process.
25-
'pausing' => ['paused', 'interrupted', 'cancelling', 'succeeded'],
23+
'pausing' => ['paused', 'cancelling', 'succeeded'],
2624
# cancelling -> cancelled occurs when the task actually halts performing
2725
# and occupies a status of cancelled.
2826
# cancelling -> succeeded occurs when the task completes immediately after

test/validators/maintenance_tasks/run_status_validator_test.rb

+2-10
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ class RunStatusValidatorTest < ActiveSupport::TestCase
167167
assert_no_invalid_transitions([:cancelling, :paused], :cancelled)
168168
end
169169

170-
test 'run can go from running or pausing to interrupted' do
170+
test 'run can go from running to interrupted' do
171171
running_run = Run.create!(
172172
task_name: 'Maintenance::UpdatePostsTask',
173173
status: :running
@@ -176,15 +176,7 @@ class RunStatusValidatorTest < ActiveSupport::TestCase
176176

177177
assert running_run.valid?
178178

179-
pausing_run = Run.create!(
180-
task_name: 'Maintenance::UpdatePostsTask',
181-
status: :pausing
182-
)
183-
pausing_run.status = :interrupted
184-
185-
assert pausing_run.valid?
186-
187-
assert_no_invalid_transitions([:running, :pausing], :interrupted)
179+
assert_no_invalid_transitions([:running], :interrupted)
188180
end
189181

190182
test 'run can go from running to errored' do

0 commit comments

Comments
 (0)