diff options
author | Christopher Baines <mail@cbaines.net> | 2018-07-04 10:45:54 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2018-07-04 10:45:54 +0100 |
commit | 9af8bba490c3390a447e95da381c981ca60c80cb (patch) | |
tree | f6602e4516288e0283bdd8b833afca6f38d48a29 | |
parent | 1b2ce776fbbe79f776f628e4ce06def1d9d17c5c (diff) | |
download | govuk-mini-environment-admin-9af8bba490c3390a447e95da381c981ca60c80cb.tar govuk-mini-environment-admin-9af8bba490c3390a447e95da381c981ca60c80cb.tar.gz |
Use finish in the govuk-guix related Que jobs
So that the entries are kept in the jobs table.
-rw-r--r-- | app/jobs/govuk_guix/create_data_snapshot_job.rb | 6 | ||||
-rw-r--r-- | app/jobs/govuk_guix/fetch_revision_job.rb | 14 |
2 files changed, 14 insertions, 6 deletions
diff --git a/app/jobs/govuk_guix/create_data_snapshot_job.rb b/app/jobs/govuk_guix/create_data_snapshot_job.rb index cadaa96..88a5ba4 100644 --- a/app/jobs/govuk_guix/create_data_snapshot_job.rb +++ b/app/jobs/govuk_guix/create_data_snapshot_job.rb @@ -87,7 +87,11 @@ class GovukGuix::CreateDataSnapshotJob < Que::Job from_remote_host: remote_host ) - GovukGuix::DataSnapshot.create!(data_snapshot_fields) + GovukGuix::DataSnapshot.transaction do + GovukGuix::DataSnapshot.create!(data_snapshot_fields) + + finish + end end def self.job_title(_que_job) diff --git a/app/jobs/govuk_guix/fetch_revision_job.rb b/app/jobs/govuk_guix/fetch_revision_job.rb index 6bec146..fd6e09c 100644 --- a/app/jobs/govuk_guix/fetch_revision_job.rb +++ b/app/jobs/govuk_guix/fetch_revision_job.rb @@ -51,11 +51,15 @@ class GovukGuix::FetchRevisionJob < Que::Job store_path = output.last.strip logger.debug(self.class) { "store_path: #{store_path}" } - GovukGuix::Revision.create( - commit_hash: sha, - store_path: store_path, - available_services: available_services(store_path, remote_host) - ) + GovukGuix::Revision.transaction do + GovukGuix::Revision.create( + commit_hash: sha, + store_path: store_path, + available_services: available_services(store_path, remote_host) + ) + + finish + end end def fetch_and_checkout(commit_hash, remote_host) |