diff options
author | Christopher Baines <mail@cbaines.net> | 2018-06-21 23:07:02 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2018-06-21 23:07:02 +0100 |
commit | d20ab544d75cf504abefae7a2611958bf07103f4 (patch) | |
tree | ec8ead1f3b0d60f8a9b1f56aa9408bdaf1a26d88 /app/jobs | |
parent | 7ae6a547c0bd87aa884080dc239e6392051d50f6 (diff) | |
download | govuk-mini-environment-admin-d20ab544d75cf504abefae7a2611958bf07103f4.tar govuk-mini-environment-admin-d20ab544d75cf504abefae7a2611958bf07103f4.tar.gz |
Remove FinishedTerraformJob
This is no longer necessary, as Que now supports keeping the job
entries around in the que_jobs table.
Diffstat (limited to 'app/jobs')
-rw-r--r-- | app/jobs/backends/deploy_terraform_libvirt_job.rb | 33 | ||||
-rw-r--r-- | app/jobs/mini_environment_job.rb | 35 |
2 files changed, 14 insertions, 54 deletions
diff --git a/app/jobs/backends/deploy_terraform_libvirt_job.rb b/app/jobs/backends/deploy_terraform_libvirt_job.rb index 3b8b51a..4565189 100644 --- a/app/jobs/backends/deploy_terraform_libvirt_job.rb +++ b/app/jobs/backends/deploy_terraform_libvirt_job.rb @@ -27,33 +27,12 @@ class Backends::DeployTerraformLibvirtJob < Que::Job .deploy_backend end - def destroy - FinishedTerraformJob.create( - model_id: @terraform_libvirt_backend_id, - job_class: attrs[:job_class] - ) - super - end - def self.jobs(terraform_libvirt_backend_id) - [ - QueJob - .where( - job_class: name - ).where( - "args->>0 = '#{terraform_libvirt_backend_id}'" - ).to_a, - FinishedTerraformJob - .where( - job_class: name, - model_id: terraform_libvirt_backend_id - ) - ].flatten.sort_by do |x| - if x.instance_of? QueJob - x.run_at - else # FinishedTerraformJob - x.created_at - end - end + QueJob + .where( + job_class: name + ).where( + "args->>0 = '#{terraform_libvirt_backend_id}'" + ).to_a end end diff --git a/app/jobs/mini_environment_job.rb b/app/jobs/mini_environment_job.rb index 90fbbd4..e5112cd 100644 --- a/app/jobs/mini_environment_job.rb +++ b/app/jobs/mini_environment_job.rb @@ -24,36 +24,17 @@ class MiniEnvironmentJob < Que::Job @mini_environment = MiniEnvironment.find(mini_environment_id) @mini_environment.backend.send(action, @mini_environment) - end - end - def destroy - FinishedTerraformJob.create( - model_id: @mini_environment.id, - job_class: attrs[:job_class] - ) - super + finish + end end def self.jobs(mini_environment_id) - [ - QueJob - .where( - job_class: name - ).where( - "args->>0 = '#{mini_environment_id}'" - ).to_a, - FinishedTerraformJob - .where( - job_class: name, - model_id: mini_environment_id - ) - ].flatten.sort_by do |x| - if x.instance_of? QueJob - x.run_at - else # FinishedTerraformJob - x.created_at - end - end + QueJob + .where( + job_class: name + ).where( + "args->>0 = '#{mini_environment_id}'" + ).to_a end end |