From e53a171916217c3b262f48857cbb46d41959b1d6 Mon Sep 17 00:00:00 2001 From: Sam Saffron Date: Thu, 15 Aug 2019 11:48:08 +1000 Subject: [PATCH] FIX: hold s3 related distributed locks longer These operations are pretty expensive and can take multiple minutes due to networking. Hold distributed mutex for much longer. --- app/models/post.rb | 2 +- lib/s3_inventory.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/post.rb b/app/models/post.rb index f9f565d6683..3cbe11e6737 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -927,7 +927,7 @@ class Post < ActiveRecord::Base missing_post_uploads = {} count = 0 - DistributedMutex.synchronize("find_missing_uploads") do + DistributedMutex.synchronize("find_missing_uploads", validity: 30.minutes) do PostCustomField.where(name: Post::MISSING_UPLOADS).delete_all query = Post .have_uploads diff --git a/lib/s3_inventory.rb b/lib/s3_inventory.rb index ebe40fddf11..b69f4a0e719 100644 --- a/lib/s3_inventory.rb +++ b/lib/s3_inventory.rb @@ -30,7 +30,7 @@ class S3Inventory return end - DistributedMutex.synchronize("s3_inventory_list_missing_#{type}") do + DistributedMutex.synchronize("s3_inventory_list_missing_#{type}", validity: 30.minutes) do begin files.each do |file| next if File.exists?(file[:filename][0...-3])