mirror of
https://github.com/internetee/registry.git
synced 2025-07-30 06:26:15 +02:00
19 lines
367 B
Ruby
19 lines
367 B
Ruby
class BouncedEmailsCleanerJob < ApplicationJob
|
|
queue_as :default
|
|
|
|
def perform
|
|
BouncedMailAddress.find_each do |bounce|
|
|
count = Contact.where(email: bounce.email).count
|
|
if count.zero?
|
|
logger.info "#{bounce.inspect} ARE DELETED!"
|
|
bounce.destroy
|
|
end
|
|
end
|
|
end
|
|
|
|
private
|
|
|
|
def logger
|
|
@logger ||= Rails.logger
|
|
end
|
|
end
|