Merge remote-tracking branch 'origin/master' into gs-master
Conflicts: .travis.yml Gemfile.lock README.md app/controllers/settings/follower_domains_controller.rb app/controllers/statuses_controller.rb app/javascript/mastodon/locales/ja.json app/lib/feed_manager.rb app/models/media_attachment.rb app/models/mute.rb app/models/status.rb app/services/mute_service.rb app/views/home/index.html.haml app/views/stream_entries/_simple_status.html.haml config/locales/ca.yml config/locales/en.yml config/locales/es.yml config/locales/fr.yml config/locales/nl.yml config/locales/pl.yml config/locales/pt-BR.yml config/themes.yml
This commit is contained in:
@@ -985,6 +985,17 @@ into similar problems in the future (e.g. when new tables are created).
|
||||
BackgroundMigrationWorker.perform_in(delay_interval * index, job_class_name, [start_id, end_id])
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# https://github.com/rails/rails/blob/v5.2.0/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb#L678-L684
|
||||
def extract_foreign_key_action(specifier)
|
||||
case specifier
|
||||
when 'c'; :cascade
|
||||
when 'n'; :nullify
|
||||
when 'r'; :restrict
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,16 +1,29 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
if ENV['REDIS_URL'].blank?
|
||||
password = ENV.fetch('REDIS_PASSWORD') { '' }
|
||||
host = ENV.fetch('REDIS_HOST') { 'localhost' }
|
||||
port = ENV.fetch('REDIS_PORT') { 6379 }
|
||||
db = ENV.fetch('REDIS_DB') { 0 }
|
||||
def setup_redis_env_url(prefix = nil, defaults = true)
|
||||
prefix = prefix.to_s.upcase + '_' unless prefix.nil?
|
||||
prefix = '' if prefix.nil?
|
||||
|
||||
ENV['REDIS_URL'] = "redis://#{password.blank? ? '' : ":#{password}@"}#{host}:#{port}/#{db}"
|
||||
return if ENV[prefix + 'REDIS_URL'].present?
|
||||
|
||||
password = ENV.fetch(prefix + 'REDIS_PASSWORD') { '' if defaults }
|
||||
host = ENV.fetch(prefix + 'REDIS_HOST') { 'localhost' if defaults }
|
||||
port = ENV.fetch(prefix + 'REDIS_PORT') { 6379 if defaults }
|
||||
db = ENV.fetch(prefix + 'REDIS_DB') { 0 if defaults }
|
||||
|
||||
ENV[prefix + 'REDIS_URL'] = if [password, host, port, db].all?(&:nil?)
|
||||
ENV['REDIS_URL']
|
||||
else
|
||||
"redis://#{password.blank? ? '' : ":#{password}@"}#{host}:#{port}/#{db}"
|
||||
end
|
||||
end
|
||||
|
||||
namespace = ENV.fetch('REDIS_NAMESPACE') { nil }
|
||||
setup_redis_env_url
|
||||
setup_redis_env_url(:cache, false)
|
||||
|
||||
namespace = ENV.fetch('REDIS_NAMESPACE') { nil }
|
||||
cache_namespace = namespace ? namespace + '_cache' : 'cache'
|
||||
|
||||
REDIS_CACHE_PARAMS = {
|
||||
expires_in: 10.minutes,
|
||||
namespace: cache_namespace,
|
||||
|
||||
Reference in New Issue
Block a user