a multi-threaded, SQL-driven ActiveJob backend used at Betterment to process millions of background jobs per day
154
stars
8
forks
source link
Handle proper values for ActiveJob.enqueue_after_transaction_commit for Rails 7.2 support #43
Closed
warmerzega closed 1 month ago
Hi Betterment friends!
As addressed in @smudge's PR https://github.com/Betterment/delayed/pull/40, Rails 7.2 introduces the concept of
enqueue_after_transaction_commit
, which should not be used in conjunction with Delayed. The implementation, and the associated tests, make the assumption that the values used by ActiveJob aretrue
andfalse
. The implementation in ActiveJob::EnqueueAfterTransactionCommit (https://github.com/rails/rails/blob/ac1d7681d05906b2b050eced76c6a2165f420821/activejob/lib/active_job/enqueue_after_transaction_commit.rb#L7-L14) uses the values of:always
and:never
. The issues arises when hitting the conditional check (https://github.com/Betterment/delayed/compare/main...warmerzega:delayed:main?expand=1#diff-325ce2458ac2c3e05143813a4899c9f996ae51f54cdb8fa5f79f50efab872f9aR20) where!!:never == true
and causes the condition to be true (and raising the exception) whenjob.class.enqueue_after_transaction_commit == :never
.