mirror of
https://github.com/internetee/registry.git
synced 2025-08-03 00:12:03 +02:00
Add logging & domain lock on release
This commit is contained in:
parent
d35042a1be
commit
0c5ef72c7d
5 changed files with 30 additions and 3 deletions
|
@ -39,9 +39,12 @@ module Concerns
|
|||
|
||||
def release
|
||||
if release_to_auction
|
||||
transaction do
|
||||
with_lock do
|
||||
to_stdout "Checking if domain_name is auctionable: #{domain_name.auctionable?}"
|
||||
domain_name.sell_at_auction if domain_name.auctionable?
|
||||
to_stdout 'Destroying domain'
|
||||
destroy!
|
||||
to_stdout 'Sending registrar notification'
|
||||
registrar.notifications.create!(text: "#{I18n.t(:domain_deleted)}: #{name}",
|
||||
attached_obj_id: id,
|
||||
attached_obj_type: self.class)
|
||||
|
@ -50,6 +53,11 @@ module Concerns
|
|||
discard
|
||||
end
|
||||
end
|
||||
|
||||
def to_stdout(message)
|
||||
time = Time.zone.now.utc
|
||||
STDOUT << "#{time} - #{message}\n" unless Rails.env.test?
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
8
app/models/concerns/to_stdout.rb
Normal file
8
app/models/concerns/to_stdout.rb
Normal file
|
@ -0,0 +1,8 @@
|
|||
module ToStdout
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
def to_stdout(message)
|
||||
time = Time.zone.now.utc
|
||||
STDOUT << "#{time} - #{message}\n" unless Rails.env.test?
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue