DEV: Always enqueue sidekiq jobs after database transaction commit (PR #11293)

When jobs are enqueued inside a transaction, it’s possible that they will be executed before the necessary data is available in the database. This commit ensures all jobs are enqueued in an ActiveRecord after_commit hook.

One potential downside here is if the job fails to enqueue, the transaction will no longer be aborted. However, the chance of that happening is reasonably low, and the impact is significantly lower than the current issue where jobs are scheduled before their data is ready.


Nice. We have seen this before will callbacks.