mirror of
https://github.com/internetee/registry.git
synced 2025-08-03 16:32:04 +02:00
Expire old pendings #2557
This commit is contained in:
parent
8102b8f1a2
commit
1769ea4227
10 changed files with 77 additions and 14 deletions
|
@ -183,6 +183,27 @@ class Domain < ActiveRecord::Base
|
|||
)
|
||||
end
|
||||
|
||||
def clean_expired_pendings
|
||||
STDOUT << "#{Time.zone.now.utc} - Clean expired domain pendings\n" unless Rails.env.test?
|
||||
|
||||
expire_at = Setting.expire_pending_confirmation.hours.ago
|
||||
count = 0
|
||||
expired_pending_domains = Domain.where('registrant_verification_asked_at <= ?', expire_at)
|
||||
expired_pending_domains.each do |domain|
|
||||
unless domain.pending_update? || domain.pending_delete?
|
||||
msg = "#{Time.zone.now.utc} - ISSUE: DOMAIN #{domain.id}: #{domain.name} IS IN EXPIRED PENDING LIST, " \
|
||||
"but no pendingDelete/pendingUpdate state present!\n"
|
||||
STDOUT << msg unless Rails.env.test?
|
||||
next
|
||||
end
|
||||
count += 1
|
||||
domain.clean_pendings!
|
||||
end
|
||||
|
||||
STDOUT << "#{Time.zone.now.utc} - Successfully cancelled #{count} domain pendings\n" unless Rails.env.test?
|
||||
count
|
||||
end
|
||||
|
||||
def start_expire_period
|
||||
STDOUT << "#{Time.zone.now.utc} - Expiring domains\n" unless Rails.env.test?
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue