Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save before lock #47

Merged
merged 3 commits into from
Aug 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/acidic_job/awaiting.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ def reenqueue_awaited_by_job
# which is what the `after_finish :reenqueue_awaited_by_job` check needs
job.instance_variable_set(:@acidic_job_run, run)

# can't reproduce yet, but saw a bug in production where
# nested awaits workflows had an unsaved `workflow` attribute
run.save! if run.has_changes_to_save?

step = Step.new(current_step, run, job, step_result)
# TODO: WRITE REGRESSION TESTS FOR PARALLEL JOB FAILING AND RETRYING THE ORIGINAL STEP
step.progress
Expand Down
4 changes: 2 additions & 2 deletions test/acidic_job/extensions/noticed_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ def test_deliver
dynamic_class = Class.new(ActiveJob::Base) do
include AcidicJob
end
Object.const_set("ApplicationJob", dynamic_class)
Noticed.parent_class = "ApplicationJob"
Object.const_set("AppJob", dynamic_class)
Noticed.parent_class = "AppJob"

delivered_to = OnlyDatabaseNotification.with({}).deliver(@user)

Expand Down
2 changes: 2 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
require "acidic_job"
require "minitest/autorun"

class CustomErrorForTesting < StandardError; end

require "combustion"
Combustion.path = "test/combustion"
Combustion.initialize! :active_record
Expand Down
Loading