Current code uses module attribute which stores value
global instead of locally (thread locally). This results
in concurrent accesses to overwrite the each other values
This is a small change to move AfterCommitQueue.inside_transaction?
to Gitlab::Database.inside_transaction? Since this change is required
by different changes which may not arrive in sequence, it's easier
to extract this change out on it's own.
This adds a method to track errors that can be recovered from in
sentry.
It is useful when debugging performance issues, or exceptions that are
hard to reproduce.
Scheduling jobs in transactions can lead to race conditions where a job
runs before a transaction has been committed. The added initializer
ensures the various Sidekiq scheduling methods raise an error when
called inside a transaction.
Fixes#27233