From 708e590117c68c3c851c4eb7287cfa03c68a0ac0 Mon Sep 17 00:00:00 2001 From: Claire Date: Sun, 12 Mar 2023 23:47:55 +0100 Subject: [PATCH] Fix sidekiq jobs not triggering Elasticsearch index updates (#24046) --- bin/tootctl | 4 +++- config/initializers/chewy.rb | 1 - lib/mastodon/sidekiq_middleware.rb | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/bin/tootctl b/bin/tootctl index a9ebb22c6..9c7ae8b87 100755 --- a/bin/tootctl +++ b/bin/tootctl @@ -5,7 +5,9 @@ require_relative '../config/boot' require_relative '../lib/cli' begin - Mastodon::CLI.start(ARGV) + Chewy.strategy(:mastodon) do + Mastodon::CLI.start(ARGV) + end rescue Interrupt exit(130) end diff --git a/config/initializers/chewy.rb b/config/initializers/chewy.rb index 752fc3c6d..2a91efefc 100644 --- a/config/initializers/chewy.rb +++ b/config/initializers/chewy.rb @@ -19,7 +19,6 @@ 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 = :mastodon Chewy.request_strategy = :mastodon Chewy.use_after_commit_callbacks = false diff --git a/lib/mastodon/sidekiq_middleware.rb b/lib/mastodon/sidekiq_middleware.rb index c75e8401f..9832e1a27 100644 --- a/lib/mastodon/sidekiq_middleware.rb +++ b/lib/mastodon/sidekiq_middleware.rb @@ -3,8 +3,8 @@ class Mastodon::SidekiqMiddleware BACKTRACE_LIMIT = 3 - def call(*) - yield + def call(*, &block) + Chewy.strategy(:mastodon, &block) rescue Mastodon::HostValidationError # Do not retry rescue => e