Skip to content

Commit

Permalink
Allow GoodJob::Job#retry_job's transaction to be joinable (fix CI f…
Browse files Browse the repository at this point in the history
…or current `rails-head`) (#1496)

* Fix CI for current `rails-head`

It is now >= 3.2 only

* Remove `joinable: false, requires_new: true` options from `Job#retry_job`

---------

Co-authored-by: Ben Sheldon [he/him] <bensheldon@gmail.com>
  • Loading branch information
Earlopain and bensheldon authored Oct 7, 2024
1 parent 62af353 commit b714be6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

ruby_30_or_higher = Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.0')
ruby_31_or_higher = Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.1')
ruby_32_or_higher = Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.2')
jruby = RUBY_PLATFORM.include?('java')

unless ruby_31_or_higher # https://github.com/rails/rails/issues/44090#issuecomment-1007686519
Expand Down Expand Up @@ -38,11 +39,13 @@ if ruby_31_or_higher
gem "rails", "~> 7.2.0.a"
gem "selenium-webdriver", "~> 4.0" # https://github.com/rails/rails/pull/43498
end
end
end

appraise "rails-head" do
gem "capybara", "~> 3.36" # For Ruby 3.1 support https://github.com/teamcapybara/capybara/pull/24
gem "rails", github: "rails/rails", branch: "main"
gem "selenium-webdriver", "~> 4.0" # https://github.com/rails/rails/pull/43498
end
if ruby_32_or_higher && !jruby
appraise "rails-head" do
gem "capybara", "~> 3.36" # For Ruby 3.1 support https://github.com/teamcapybara/capybara/pull/24
gem "rails", github: "rails/rails", branch: "main"
gem "selenium-webdriver", "~> 4.0" # https://github.com/rails/rails/pull/43498
end
end
2 changes: 1 addition & 1 deletion app/models/good_job/job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ def retry_job
current_thread.job = self
current_thread.retry_now = true

self.class.transaction(joinable: false, requires_new: true) do
transaction do
new_active_job = active_job.retry_job(wait: 0, error: error)
self.error_event = :retried if error
save!
Expand Down

0 comments on commit b714be6

Please sign in to comment.