mirror of
https://git.bsd.gay/fef/nyastodon.git
synced 2024-12-25 06:13:43 +01: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
4 changed files with 5 additions and 13 deletions
1
Gemfile
1
Gemfile
|
@ -16,7 +16,6 @@ gem 'dotenv-rails', '~> 2.2', '< 2.3'
|
||||||
|
|
||||||
gem 'aws-sdk-s3', '~> 1.9', require: false
|
gem 'aws-sdk-s3', '~> 1.9', require: false
|
||||||
gem 'fog-core', '~> 1.45'
|
gem 'fog-core', '~> 1.45'
|
||||||
gem 'fog-local', '~> 0.5', require: false
|
|
||||||
gem 'fog-openstack', '~> 0.1', require: false
|
gem 'fog-openstack', '~> 0.1', require: false
|
||||||
gem 'paperclip', '~> 6.0'
|
gem 'paperclip', '~> 6.0'
|
||||||
gem 'paperclip-av-transcoder', '~> 0.6'
|
gem 'paperclip-av-transcoder', '~> 0.6'
|
||||||
|
|
|
@ -220,8 +220,6 @@ GEM
|
||||||
fog-json (1.0.2)
|
fog-json (1.0.2)
|
||||||
fog-core (~> 1.0)
|
fog-core (~> 1.0)
|
||||||
multi_json (~> 1.10)
|
multi_json (~> 1.10)
|
||||||
fog-local (0.5.0)
|
|
||||||
fog-core (>= 1.27, < 3.0)
|
|
||||||
fog-openstack (0.1.25)
|
fog-openstack (0.1.25)
|
||||||
fog-core (~> 1.40)
|
fog-core (~> 1.40)
|
||||||
fog-json (>= 1.0)
|
fog-json (>= 1.0)
|
||||||
|
@ -679,7 +677,6 @@ DEPENDENCIES
|
||||||
fast_blank (~> 1.0)
|
fast_blank (~> 1.0)
|
||||||
fastimage
|
fastimage
|
||||||
fog-core (~> 1.45)
|
fog-core (~> 1.45)
|
||||||
fog-local (~> 0.5)
|
|
||||||
fog-openstack (~> 0.1)
|
fog-openstack (~> 0.1)
|
||||||
fuubar (~> 2.2)
|
fuubar (~> 2.2)
|
||||||
goldfinger (~> 2.1)
|
goldfinger (~> 2.1)
|
||||||
|
|
|
@ -8,7 +8,7 @@ class Maintenance::UncacheMediaWorker
|
||||||
def perform(media_attachment_id)
|
def perform(media_attachment_id)
|
||||||
media = MediaAttachment.find(media_attachment_id)
|
media = MediaAttachment.find(media_attachment_id)
|
||||||
|
|
||||||
return unless media.file.exists?
|
return if media.file.blank?
|
||||||
|
|
||||||
media.file.destroy
|
media.file.destroy
|
||||||
media.save
|
media.save
|
||||||
|
|
|
@ -74,14 +74,10 @@ elsif ENV['SWIFT_ENABLED'] == 'true'
|
||||||
fog_public: true
|
fog_public: true
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
require 'fog/local'
|
|
||||||
|
|
||||||
Paperclip::Attachment.default_options.merge!(
|
Paperclip::Attachment.default_options.merge!(
|
||||||
fog_credentials: {
|
storage: :filesystem,
|
||||||
provider: 'Local',
|
use_timestamp: true,
|
||||||
local_root: ENV.fetch('PAPERCLIP_ROOT_PATH') { Rails.root.join('public', 'system') },
|
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',
|
||||||
fog_directory: '',
|
|
||||||
fog_host: ENV.fetch('PAPERCLIP_ROOT_URL') { '/system' }
|
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue