Deleting of a GitLab Pages project results in "`PagesWorker.perform_in` cannot be called inside a transaction"
https://sentry.gitlap.com/gitlab/gitlabcom/issues/37784/
RuntimeError: `PagesWorker.perform_in` cannot be called inside a transaction as this can lead to
race conditions when the worker runs before the transaction is committed and
tries to access a model that has not been saved yet.
Use an `after_commit` hook, or include `AfterCommitQueue` and use a `run_after_commit` block instead.
config/initializers/forbid_sidekiq_in_transactions.rb:23:in `block (2 levels) in <module:NoSchedulingFromTransactions>'
raise <<-MSG.strip_heredoc
app/models/project.rb:1275:in `remove_pages'
PagesWorker.perform_in(5.minutes, :remove, namespace.full_path, temp_path)
lib/gitlab/metrics/instrumentation.rb:156:in `block in remove_pages'
trans.method_call_for(#{label.to_sym.inspect}).measure { super }
lib/gitlab/metrics/method_call.rb:23:in `measure'
retval = yield
lib/gitlab/metrics/instrumentation.rb:156:in `remove_pages'
trans.method_call_for(#{label.to_sym.inspect}).measure { super }
...
(62 additional frame(s) were not displayed)
`PagesWorker.perform_in` cannot be called inside a transaction as this can lead to
race conditions when the worker runs before the transaction is committed and
tries to access a model that has not been saved yet.
Use an `after_commit` hook, or include `AfterCommitQueue` and use a `run_after_commit` block instead.