Commit 180b1e93 authored by Andreas Brandl's avatar Andreas Brandl

Raise early and helpful

parent a50a945f
...@@ -41,6 +41,14 @@ module Gitlab ...@@ -41,6 +41,14 @@ module Gitlab
# * +logger+ - [Gitlab::JsonLogger] # * +logger+ - [Gitlab::JsonLogger]
# * +env+ - [Hash] custom environment hash, see the example with `DISABLE_LOCK_RETRIES` # * +env+ - [Hash] custom environment hash, see the example with `DISABLE_LOCK_RETRIES`
def with_lock_retries(*args, **kwargs, &block) def with_lock_retries(*args, **kwargs, &block)
if transaction_open?
raise <<~EOF
#{__callee__} can not be run inside an already open transaction
Use migration-level lock retries instead, see https://docs.gitlab.com/ee/development/migration_style_guide.html#retry-mechanism-when-acquiring-database-locks
EOF
end
super(*args, **kwargs.merge(allow_savepoints: false), &block) super(*args, **kwargs.merge(allow_savepoints: false), &block)
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment