Commit b4129d6f authored by Krasimir Angelov's avatar Krasimir Angelov

Update with_lock_retries helper keyword argument name

from `safe` to `raise_on_exhaustion`, in order to match what we pass to
Gitlab::Database::WithLockRetries.
parent 6e5fc9ee
......@@ -31,7 +31,7 @@ class FinalizePushEventPayloadsBigintConversion < ActiveRecord::Migration[6.1]
# Duplicate fk_36c74129da FK
add_concurrent_foreign_key TABLE_NAME, :events, column: :event_id_convert_to_bigint, on_delete: :cascade
with_lock_retries(safe: true) do
with_lock_retries(raise_on_exhaustion: true) do
swap_column_names TABLE_NAME, :event_id, :event_id_convert_to_bigint # rubocop:disable Migration/WithLockRetriesDisallowedMethod
# Swap defaults
......
......@@ -389,7 +389,7 @@ module Gitlab
# * +logger+ - [Gitlab::JsonLogger]
# * +env+ - [Hash] custom environment hash, see the example with `DISABLE_LOCK_RETRIES`
def with_lock_retries(*args, **kwargs, &block)
raise_on_exhaustion = !!kwargs.delete(:safe)
raise_on_exhaustion = !!kwargs.delete(:raise_on_exhaustion)
merged_args = {
klass: self.class,
logger: Gitlab::BackgroundMigration::Logger
......
......@@ -2160,10 +2160,7 @@ RSpec.describe Gitlab::Database::MigrationHelpers do
using RSpec::Parameterized::TableSyntax
where(:safe, :raise_on_exhaustion) do
true | true
false | false
end
where(raise_on_exhaustion: [true, false])
with_them do
it 'sets raise_on_exhaustion as requested' do
......@@ -2171,7 +2168,7 @@ RSpec.describe Gitlab::Database::MigrationHelpers do
expect(Gitlab::Database::WithLockRetries).to receive(:new).and_return(with_lock_retries)
expect(with_lock_retries).to receive(:run).with(raise_on_exhaustion: raise_on_exhaustion)
model.with_lock_retries(env: env, logger: in_memory_logger, safe: safe) { }
model.with_lock_retries(env: env, logger: in_memory_logger, raise_on_exhaustion: raise_on_exhaustion) { }
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