Merge remote-tracking branch 'tootsuite/master' into glitchsoc/master

This commit is contained in:
Jenkins
2018-04-11 00:50:09 +00:00
40 changed files with 488 additions and 110 deletions

View File

@ -0,0 +1,4 @@
ActiveSupport::Notifications.subscribe('rack.attack') do |_name, _start, _finish, _request_id, req|
next unless [:throttle, :blacklist].include? req.env['rack.attack.match_type']
Rails.logger.info("Rate limit hit (#{req.env['rack.attack.match_type']}): #{req.ip} #{req.request_method} #{req.fullpath}")
end

View File

@ -1,10 +1,10 @@
# frozen_string_literal: true
namespace = ENV.fetch('REDIS_NAMESPACE') { nil }
namespace = ENV.fetch('REDIS_NAMESPACE') { nil }
redis_params = { url: ENV['REDIS_URL'] }
if namespace
redis_params [:namespace] = namespace
redis_params[:namespace] = namespace
end
Sidekiq.configure_server do |config|
@ -18,3 +18,5 @@ end
Sidekiq.configure_client do |config|
config.redis = redis_params
end
Sidekiq::Logging.logger.level = ::Logger::const_get(ENV.fetch('RAILS_LOG_LEVEL', 'info').upcase.to_s)