mirror of
https://github.com/mastodon/mastodon
synced 2024-12-01 00:08:21 +09:00
Revert to using Paperclip's filesystem storage, and fix dangling records in remove_remote (#8339)
* Fix uncaching worker * Revert to using Paperclip's filesystem backend instead of fog-local fog-local has lots of concurrency issues, causing failure to delete files, dangling file records, and spurious errors UncacheMediaWorker
This commit is contained in:
parent
d98de8ada7
commit
f06fa09962
1
Gemfile
1
Gemfile
@ -16,7 +16,6 @@ gem 'dotenv-rails', '~> 2.2', '< 2.3'
|
||||
|
||||
gem 'aws-sdk-s3', '~> 1.9', require: false
|
||||
gem 'fog-core', '~> 1.45'
|
||||
gem 'fog-local', '~> 0.5', require: false
|
||||
gem 'fog-openstack', '~> 0.1', require: false
|
||||
gem 'paperclip', '~> 6.0'
|
||||
gem 'paperclip-av-transcoder', '~> 0.6'
|
||||
|
@ -220,8 +220,6 @@ GEM
|
||||
fog-json (1.0.2)
|
||||
fog-core (~> 1.0)
|
||||
multi_json (~> 1.10)
|
||||
fog-local (0.5.0)
|
||||
fog-core (>= 1.27, < 3.0)
|
||||
fog-openstack (0.1.25)
|
||||
fog-core (~> 1.40)
|
||||
fog-json (>= 1.0)
|
||||
@ -679,7 +677,6 @@ DEPENDENCIES
|
||||
fast_blank (~> 1.0)
|
||||
fastimage
|
||||
fog-core (~> 1.45)
|
||||
fog-local (~> 0.5)
|
||||
fog-openstack (~> 0.1)
|
||||
fuubar (~> 2.2)
|
||||
goldfinger (~> 2.1)
|
||||
|
@ -8,7 +8,7 @@ class Maintenance::UncacheMediaWorker
|
||||
def perform(media_attachment_id)
|
||||
media = MediaAttachment.find(media_attachment_id)
|
||||
|
||||
return unless media.file.exists?
|
||||
return if media.file.blank?
|
||||
|
||||
media.file.destroy
|
||||
media.save
|
||||
|
@ -74,14 +74,10 @@ elsif ENV['SWIFT_ENABLED'] == 'true'
|
||||
fog_public: true
|
||||
)
|
||||
else
|
||||
require 'fog/local'
|
||||
|
||||
Paperclip::Attachment.default_options.merge!(
|
||||
fog_credentials: {
|
||||
provider: 'Local',
|
||||
local_root: ENV.fetch('PAPERCLIP_ROOT_PATH') { Rails.root.join('public', 'system') },
|
||||
},
|
||||
fog_directory: '',
|
||||
fog_host: ENV.fetch('PAPERCLIP_ROOT_URL') { '/system' }
|
||||
storage: :filesystem,
|
||||
use_timestamp: true,
|
||||
path: (ENV['PAPERCLIP_ROOT_PATH'] || ':rails_root/public/system') + '/:class/:attachment/:id_partition/:style/:filename',
|
||||
url: (ENV['PAPERCLIP_ROOT_URL'] || '/system') + '/:class/:attachment/:id_partition/:style/:filename',
|
||||
)
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user