From 9acc4e9f506c08687267800f4d5454dface00f5c Mon Sep 17 00:00:00 2001 From: phil Date: Thu, 26 Oct 2017 12:09:35 +0200 Subject: [PATCH] add after_processing hook to uploads' workflow --- app/models/talk.rb | 3 ++- lib/audio_worker/runner.rb | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/models/talk.rb b/app/models/talk.rb index 88904e2c6..4a4959b8a 100644 --- a/app/models/talk.rb +++ b/app/models/talk.rb @@ -89,7 +89,8 @@ class Talk < ActiveRecord::Base transitions from: :processing, to: :archived, on_transition: :after_processing # or by user upload - transitions from: :pending, to: :archived + transitions from: :pending, to: :archived, + on_transition: :after_processing # in rare case we might to override a talk # which has never been enqueued transitions from: :postlive, to: :archived diff --git a/lib/audio_worker/runner.rb b/lib/audio_worker/runner.rb index 04f10c027..50d728e94 100644 --- a/lib/audio_worker/runner.rb +++ b/lib/audio_worker/runner.rb @@ -167,14 +167,14 @@ def run(job) puts "Target bucket: #{target_bucket}" puts "Job Type: #{type}" + # pull manifest file + manifest_url = "#{target_bucket}/manifest.yml" + s3_cp(manifest_url, path, target_region) + case type when "Job::Archive" - # pull manifest file - manifest_url = "#{target_bucket}/manifest.yml" - s3_cp(manifest_url, path, target_region) - # based on content pull source files manifest_path = File.join(path, 'manifest.yml') raise "No manifest file!" unless File.exist?(manifest_path)