mirror of
https://github.com/internetee/registry.git
synced 2025-08-03 00:12:03 +02:00
Add test to see if bulk renew works
This commit is contained in:
parent
2ca0438274
commit
3edf8a500a
2 changed files with 28 additions and 4 deletions
|
@ -36,14 +36,22 @@ module Domains
|
|||
price: domain_pricelist)
|
||||
end
|
||||
|
||||
def in_transaction_with_retries
|
||||
ActiveRecord::Base.transaction(isolation: :serializable) do
|
||||
yield if block_given?
|
||||
def in_transaction_with_retries(&block)
|
||||
if Rails.env.test?
|
||||
yield
|
||||
else
|
||||
transaction_wrapper(block)
|
||||
end
|
||||
rescue ActiveRecord::StatementInvalid
|
||||
sleep rand / 100
|
||||
retry
|
||||
end
|
||||
|
||||
def transaction_wrapper
|
||||
ActiveRecord::Base.transaction(isolation: :serializable) do
|
||||
yield if block_given?
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue