mirror of
https://github.com/internetee/registry.git
synced 2025-06-10 06:34:46 +02:00
Implemented job and test
This commit is contained in:
parent
eac7dd352b
commit
f3612fc1e4
2 changed files with 25 additions and 0 deletions
10
app/jobs/bounced_emails_cleaner_job.rb
Normal file
10
app/jobs/bounced_emails_cleaner_job.rb
Normal file
|
@ -0,0 +1,10 @@
|
|||
class BouncedEmailsCleanerJob < ApplicationJob
|
||||
queue_as :default
|
||||
|
||||
def perform
|
||||
BouncedMailAddress.find_each do |bounce|
|
||||
count = Contact.where(email: bounce.email).count
|
||||
bounce.destroy if count == 0
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue