mirror of
https://github.com/internetee/registry.git
synced 2025-07-29 22:16:19 +02:00
Remove legacy que
This commit is contained in:
parent
031a825b3b
commit
f9be2152e6
20 changed files with 15 additions and 402 deletions
|
@ -1,31 +0,0 @@
|
|||
namespace :migrate_jobs do
|
||||
task all: :environment do
|
||||
QueJob.all.each do |job|
|
||||
process_que_job(job)
|
||||
end
|
||||
end
|
||||
|
||||
task first: :environment do
|
||||
job = QueJob.first
|
||||
process_que_job(job)
|
||||
end
|
||||
|
||||
def process_que_job(que_job)
|
||||
return unless que_job
|
||||
|
||||
if skip_condition(que_job)
|
||||
puts "Skipped Que job migration: #{que_job.inspect}"
|
||||
else
|
||||
args = que_job.args
|
||||
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)
|
||||
end
|
||||
end
|
||||
|
||||
def skip_condition(que_job)
|
||||
que_job.last_error.present? || !(que_job.job_class.constantize < ApplicationJob) ||
|
||||
!(que_job.job_class == 'DomainExpireEmailJob')
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue