You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, thanks for all the hard work on this gem! I've been trying to use this gem to prevent ActiveJob jobs from enqueueing within transactions but have run into some unexpected behavior. If my job looks like the following:
class TestJob < ActiveJob::Base
before_enqueue do |job|
puts "1"
end
around_enqueue do |job, block|
puts "2"
block.call
end
include AfterCommitEverywhere
around_enqueue do |job, block|
puts "3"
after_commit { block.call }
end
around_enqueue do |job, block|
puts "4"
block.call
end
def perform; end
end
And I try to enqueue it from within a transaction:
ActiveRecord::Base.transaction do
TestJob.perform_later
end
It outputs 123 1234 instead of 1234 that I'm expecting. It seems like all the callbacks preceding the callback that has after_commit are run twice instead of once.
This is on Rails 6.0.6.1 with after_commit_everywhere (1.1.0).
Am I doing something wrong here or is this a bug in the gem?
The text was updated successfully, but these errors were encountered:
Hello, thanks for all the hard work on this gem! I've been trying to use this gem to prevent ActiveJob jobs from enqueueing within transactions but have run into some unexpected behavior. If my job looks like the following:
And I try to enqueue it from within a transaction:
It outputs
123 1234
instead of1234
that I'm expecting. It seems like all the callbacks preceding the callback that hasafter_commit
are run twice instead of once.This is on
Rails 6.0.6.1
withafter_commit_everywhere (1.1.0)
.Am I doing something wrong here or is this a bug in the gem?
The text was updated successfully, but these errors were encountered: