Fix OpenStack Swift Keystone token rate limiting (#38145)

This commit is contained in:
Hugo Gameiro
2026-03-12 10:15:49 +00:00
committed by GitHub
parent 94aa5d7c9e
commit 4552cda15a

View File

@@ -0,0 +1,17 @@
# frozen_string_literal: true
if ENV['SWIFT_ENABLED'] == 'true'
module PaperclipFogConnectionCache
def connection
@connection ||= begin
key = fog_credentials.hash
Thread.current[:paperclip_fog_connections] ||= {}
Thread.current[:paperclip_fog_connections][key] ||= ::Fog::Storage.new(fog_credentials)
end
end
end
Rails.application.config.after_initialize do
Paperclip::Storage::Fog.prepend(PaperclipFogConnectionCache)
end
end