From 2f7c3cb628ddf0438452325c52359f575aab6890 Mon Sep 17 00:00:00 2001 From: Alison Wheeler Date: Sun, 2 Apr 2023 05:49:37 +0100 Subject: Update redis_config.rb to remove warning message (#24352) --- lib/mastodon/redis_config.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/mastodon/redis_config.rb b/lib/mastodon/redis_config.rb index 3e97da873..2dbe76f83 100644 --- a/lib/mastodon/redis_config.rb +++ b/lib/mastodon/redis_config.rb @@ -35,7 +35,7 @@ REDIS_CACHE_PARAMS = { url: ENV['CACHE_REDIS_URL'], expires_in: 10.minutes, namespace: cache_namespace, - pool_size: Sidekiq.server? ? Sidekiq.options[:concurrency] : Integer(ENV['MAX_THREADS'] || 5), + pool_size: Sidekiq.server? ? Sidekiq[:concurrency] : Integer(ENV['MAX_THREADS'] || 5), pool_timeout: 5, connect_timeout: 5, }.freeze -- cgit From 5c499f54e3ecc2fab6de2ff76441a11ddf3c503d Mon Sep 17 00:00:00 2001 From: Claire Date: Mon, 3 Apr 2023 15:05:39 +0200 Subject: Change root Chewy strategy to emit a warning instead of erroring out in production mode (#24327) --- config/application.rb | 1 + config/initializers/chewy.rb | 1 + lib/chewy/strategy/bypass_with_warning.rb | 12 ++++++++++++ 3 files changed, 14 insertions(+) create mode 100644 lib/chewy/strategy/bypass_with_warning.rb (limited to 'lib') diff --git a/config/application.rb b/config/application.rb index 43631c551..f0e65f443 100644 --- a/config/application.rb +++ b/config/application.rb @@ -39,6 +39,7 @@ require_relative '../lib/public_file_server_middleware' require_relative '../lib/devise/two_factor_ldap_authenticatable' require_relative '../lib/devise/two_factor_pam_authenticatable' require_relative '../lib/chewy/strategy/mastodon' +require_relative '../lib/chewy/strategy/bypass_with_warning' require_relative '../lib/webpacker/manifest_extensions' require_relative '../lib/webpacker/helper_extensions' require_relative '../lib/rails/engine_extensions' diff --git a/config/initializers/chewy.rb b/config/initializers/chewy.rb index 2a91efefc..daf4a5f32 100644 --- a/config/initializers/chewy.rb +++ b/config/initializers/chewy.rb @@ -19,6 +19,7 @@ Chewy.settings = { # cycle, which takes care of checking if Elasticsearch is enabled # or not. However, mind that for the Rails console, the :urgent # strategy is set automatically with no way to override it. +Chewy.root_strategy = :bypass_with_warning if Rails.env.production? Chewy.request_strategy = :mastodon Chewy.use_after_commit_callbacks = false diff --git a/lib/chewy/strategy/bypass_with_warning.rb b/lib/chewy/strategy/bypass_with_warning.rb new file mode 100644 index 000000000..eb6fbaab1 --- /dev/null +++ b/lib/chewy/strategy/bypass_with_warning.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Chewy + class Strategy + class BypassWithWarning < Base + def update(...) + Rails.logger.warn 'Chewy update without a root strategy' unless @warning_issued + @warning_issued = true + end + end + end +end -- cgit