diff --git a/DOCKER-SWARM.md b/DOCKER-SWARM.md index 5d165c0..fa26201 100644 --- a/DOCKER-SWARM.md +++ b/DOCKER-SWARM.md @@ -157,6 +157,8 @@ docker push 127.0.0.1:5000/cw-ovp ## Run stack ``` docker stack deploy --compose-file docker-stack.yml CW-OVP +docker image prune -a -f + docker exec -it 1f7193e6042e bundle exec rails webpacker:install docker exec -it 1f7193e6042e bundle exec rake db:migrate ``` diff --git a/app/workers/encode_worker.rb b/app/workers/encode_worker.rb index df350d0..e180776 100644 --- a/app/workers/encode_worker.rb +++ b/app/workers/encode_worker.rb @@ -1,6 +1,6 @@ class EncodeWorker include Sidekiq::Worker - sidekiq_options retry: false, backtrace: true + sidekiq_options retry: 0, backtrace: true def perform(encode_id) encode = Encode.find(encode_id) diff --git a/app/workers/thumbnail_worker.rb b/app/workers/thumbnail_worker.rb index 5872111..a00e179 100644 --- a/app/workers/thumbnail_worker.rb +++ b/app/workers/thumbnail_worker.rb @@ -1,6 +1,6 @@ class ThumbnailWorker include Sidekiq::Worker - sidekiq_options retry: false, backtrace: true + sidekiq_options retry: 0, backtrace: true def perform(encode_id) encode = Encode.find(encode_id) @@ -18,8 +18,12 @@ def perform(encode_id) thumbnail_file_full_path = "#{thumbnail_local_full_path}/#{thumbnail_filename}" thumbnail_cmd = Bash::Thumbnail.call(uploaded_file_path, ss, thumbnail_file_full_path) thumbnail_url = Storage::Url::Full::Thumbnail.call(encode, base_url, thumbnail_filename) - encode.assets.create(format: 'image', url: thumbnail_url) - encode.thumbnails.attach(io: File.open(thumbnail_file_full_path), filename: thumbnail_filename, content_type: "image/png") + + ActiveRecord::Base.connection_pool.release_connection + ActiveRecord::Base.connection_pool.with_connection do + encode.assets.create(format: 'image', url: thumbnail_url) + encode.thumbnails.attach(io: File.open(thumbnail_file_full_path), filename: thumbnail_filename, content_type: "image/png") + end message = "Extracted #{i}th Thumbnail" cdn_bucket = ENV['CDN_BUCKET']