aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/jobs/govuk_guix/create_data_snapshot_job.rb6
-rw-r--r--app/jobs/govuk_guix/fetch_revision_job.rb14
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)