aboutsummaryrefslogtreecommitdiff
path: root/app/jobs/mini_environment_job.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/jobs/mini_environment_job.rb')
-rw-r--r--app/jobs/mini_environment_job.rb35
1 files changed, 8 insertions, 27 deletions
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