-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1871 from internetee/645-2-gracefully-drop-que-em…
…ail-jobs-sidekiq Change Que for Sidekiq as job backend
- Loading branch information
Showing
70 changed files
with
436 additions
and
222 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
class ApplicationJob < ActiveJob::Base | ||
discard_on NoMethodError | ||
queue_as :default | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,39 @@ | ||
class DomainDeleteConfirmJob < ApplicationJob | ||
queue_as :default | ||
|
||
def perform(domain_id, action, initiator = nil) | ||
domain = Epp::Domain.find(domain_id) | ||
|
||
Domains::DeleteConfirm::ProcessAction.run(domain: domain, | ||
action: action, | ||
initiator: initiator) | ||
end | ||
|
||
private | ||
|
||
def action_confirmed(domain) | ||
domain.notify_registrar(:poll_pending_delete_confirmed_by_registrant) | ||
domain.apply_pending_delete! | ||
raise_errors!(domain) | ||
end | ||
|
||
def action_rejected(domain) | ||
domain.statuses.delete(DomainStatus::PENDING_DELETE_CONFIRMATION) | ||
domain.notify_registrar(:poll_pending_delete_rejected_by_registrant) | ||
|
||
domain.cancel_pending_delete | ||
domain.save(validate: false) | ||
raise_errors!(domain) | ||
notify_on_domain(domain) | ||
end | ||
|
||
def notify_on_domain(domain) | ||
if domain.registrant_verification_token.blank? | ||
Rails.logger.warn 'EMAIL NOT DELIVERED: registrant_verification_token is missing for '\ | ||
"#{domain.name}" | ||
elsif domain.registrant_verification_asked_at.blank? | ||
Rails.logger.warn 'EMAIL NOT DELIVERED: registrant_verification_asked_at is missing for '\ | ||
"#{domain.name}" | ||
else | ||
DomainDeleteMailer.rejected(domain).deliver_now | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
class RegenerateRegistrarWhoisesJob < Que::Job | ||
def run(registrar_id) | ||
class RegenerateRegistrarWhoisesJob < ApplicationJob | ||
retry_on StandardError, wait: 2.seconds, attempts: 3 | ||
|
||
def perform(registrar_id) | ||
# no return as we want restart job if fails | ||
registrar = Registrar.find(registrar_id) | ||
|
||
registrar.whois_records.select(:name).find_in_batches(batch_size: 20) do |group| | ||
UpdateWhoisRecordJob.enqueue group.map(&:name), 'domain' | ||
UpdateWhoisRecordJob.perform_later group.map(&:name), 'domain' | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
class RegenerateSubzoneWhoisesJob < Que::Job | ||
def run | ||
class RegenerateSubzoneWhoisesJob < ApplicationJob | ||
def perform | ||
subzones = DNS::Zone.all | ||
|
||
subzones.each do |zone| | ||
next unless zone.subzone? | ||
|
||
UpdateWhoisRecordJob.enqueue zone.origin, 'zone' | ||
UpdateWhoisRecordJob.perform_later zone.origin, 'zone' | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
class RegistrantChangeExpiredEmailJob < ApplicationJob | ||
def perform(domain_id) | ||
domain = Domain.find(domain_id) | ||
log(domain) | ||
RegistrantChangeMailer.expired(domain: domain, | ||
registrar: domain.registrar, | ||
registrant: domain.registrant, | ||
send_to: [domain.new_registrant_email, | ||
domain.registrant.email]).deliver_now | ||
end | ||
|
||
private | ||
|
||
def log(domain) | ||
message = 'Send RegistrantChangeMailer#expired email for domain '\ | ||
"#{domain.name} (##{domain.id}) to #{domain.new_registrant_email}" | ||
logger.info(message) | ||
end | ||
|
||
def logger | ||
Rails.logger | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
class UpdateWhoisRecordJob < Que::Job | ||
def run(names, type) | ||
class UpdateWhoisRecordJob < ApplicationJob | ||
def perform(names, type) | ||
Whois::Update.run(names: [names].flatten, type: type) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ def payable? | |
end | ||
|
||
def paid? | ||
account_activity | ||
account_activity.present? | ||
end | ||
|
||
def receipt_date | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.