mirror of
https://github.com/internetee/registry.git
synced 2025-06-07 13:15:40 +02:00
Fix DomainExpireEmailJob migration
This commit is contained in:
parent
590a50b4b1
commit
5bee61d664
2 changed files with 6 additions and 3 deletions
|
@ -1,7 +1,8 @@
|
||||||
class DomainExpireEmailJob < ApplicationJob
|
class DomainExpireEmailJob < ApplicationJob
|
||||||
def perform(domain_id, email)
|
def perform(domain_id, email)
|
||||||
domain = Domain.find(domain_id)
|
domain = Domain.find_by(id: domain_id)
|
||||||
|
|
||||||
|
return if domain.blank?
|
||||||
return if domain.registered?
|
return if domain.registered?
|
||||||
|
|
||||||
attrs = {
|
attrs = {
|
||||||
|
|
|
@ -18,12 +18,14 @@ namespace :migrate_jobs do
|
||||||
else
|
else
|
||||||
args = que_job.args
|
args = que_job.args
|
||||||
time = que_job.run_at
|
time = que_job.run_at
|
||||||
|
time = Time.zone.now + 1.minute if time < Time.zone.now
|
||||||
|
|
||||||
que_job.job_class.constantize.set(wait_until: time).perform_later(args)
|
que_job.job_class.constantize.set(wait_until: time).perform_later(*args)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def skip_condition(que_job)
|
def skip_condition(que_job)
|
||||||
que_job.last_error.present? || !(que_job.job_class.constantize < ApplicationJob)
|
que_job.last_error.present? || !(que_job.job_class.constantize < ApplicationJob) ||
|
||||||
|
!(que_job.job_class == 'DomainExpireEmailJob')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue