Update chewy to version 8.0.1 (#37983)

This commit is contained in:
Matt Jankowski
2026-03-17 09:27:37 -04:00
committed by GitHub
parent 3d4364a2a6
commit 4d33490ec8
10 changed files with 38 additions and 22 deletions

View File

@@ -27,7 +27,7 @@ gem 'addressable', '~> 2.8'
gem 'bootsnap', require: false gem 'bootsnap', require: false
gem 'browser' gem 'browser'
gem 'charlock_holmes', '~> 0.7.7' gem 'charlock_holmes', '~> 0.7.7'
gem 'chewy', '~> 7.3' gem 'chewy'
gem 'devise' gem 'devise'
gem 'devise-two-factor' gem 'devise-two-factor'

View File

@@ -159,9 +159,9 @@ GEM
cbor (0.5.10.1) cbor (0.5.10.1)
cgi (0.5.1) cgi (0.5.1)
charlock_holmes (0.7.9) charlock_holmes (0.7.9)
chewy (7.6.0) chewy (8.0.1)
activesupport (>= 5.2) activesupport (>= 7.2)
elasticsearch (>= 7.14.0, < 8) elasticsearch (>= 8.14, < 9.0)
elasticsearch-dsl elasticsearch-dsl
childprocess (5.1.0) childprocess (5.1.0)
logger (~> 1.5) logger (~> 1.5)
@@ -214,16 +214,16 @@ GEM
dotenv (3.2.0) dotenv (3.2.0)
drb (2.2.3) drb (2.2.3)
dry-cli (1.4.1) dry-cli (1.4.1)
elasticsearch (7.17.11) elastic-transport (8.4.1)
elasticsearch-api (= 7.17.11) faraday (< 3)
elasticsearch-transport (= 7.17.11) multi_json
elasticsearch-api (7.17.11) elasticsearch (8.19.3)
elastic-transport (~> 8.3)
elasticsearch-api (= 8.19.3)
ostruct
elasticsearch-api (8.19.3)
multi_json multi_json
elasticsearch-dsl (0.1.10) elasticsearch-dsl (0.1.10)
elasticsearch-transport (7.17.11)
base64
faraday (>= 1, < 3)
multi_json
email_validator (2.2.4) email_validator (2.2.4)
activemodel activemodel
erb (6.0.2) erb (6.0.2)
@@ -959,7 +959,7 @@ DEPENDENCIES
capybara (~> 3.39) capybara (~> 3.39)
capybara-playwright-driver capybara-playwright-driver
charlock_holmes (~> 0.7.7) charlock_holmes (~> 0.7.7)
chewy (~> 7.3) chewy
climate_control climate_control
cocoon (~> 1.2) cocoon (~> 1.2)
color_diff (~> 0.1) color_diff (~> 0.1)

View File

@@ -65,7 +65,7 @@ class Admin::Metrics::Dimension::SoftwareVersionsDimension < Admin::Metrics::Dim
value: version, value: version,
human_value: version, human_value: version,
} }
rescue Faraday::ConnectionFailed, Elasticsearch::Transport::Transport::Error rescue Faraday::ConnectionFailed, Elastic::Transport::Transport::Error
nil nil
end end

View File

@@ -69,7 +69,7 @@ class Admin::Metrics::Dimension::SpaceUsageDimension < Admin::Metrics::Dimension
unit: 'bytes', unit: 'bytes',
human_value: number_to_human_size(value), human_value: number_to_human_size(value),
} }
rescue Faraday::ConnectionFailed, Elasticsearch::Transport::Transport::Error rescue Faraday::ConnectionFailed, Elastic::Transport::Transport::Error
nil nil
end end
end end

View File

@@ -17,7 +17,7 @@ class Admin::SystemCheck::ElasticsearchCheck < Admin::SystemCheck::BaseCheck
return true unless Chewy.enabled? return true unless Chewy.enabled?
running_version.present? && compatible_version? && cluster_health['status'] == 'green' && indexes_match? && specifications_match? && preset_matches? running_version.present? && compatible_version? && cluster_health['status'] == 'green' && indexes_match? && specifications_match? && preset_matches?
rescue Faraday::ConnectionFailed, Elasticsearch::Transport::Transport::Error, HTTPClient::KeepAliveDisconnected rescue Faraday::ConnectionFailed, Elastic::Transport::Transport::Error, HTTPClient::KeepAliveDisconnected
false false
end end
@@ -54,7 +54,7 @@ class Admin::SystemCheck::ElasticsearchCheck < Admin::SystemCheck::BaseCheck
else else
Admin::SystemCheck::Message.new(:elasticsearch_preset, nil, 'https://docs.joinmastodon.org/admin/elasticsearch/#scaling') Admin::SystemCheck::Message.new(:elasticsearch_preset, nil, 'https://docs.joinmastodon.org/admin/elasticsearch/#scaling')
end end
rescue Faraday::ConnectionFailed, Elasticsearch::Transport::Transport::Error, HTTPClient::KeepAliveDisconnected rescue Faraday::ConnectionFailed, Elastic::Transport::Transport::Error, HTTPClient::KeepAliveDisconnected
Admin::SystemCheck::Message.new(:elasticsearch_running_check) Admin::SystemCheck::Message.new(:elasticsearch_running_check)
end end
@@ -67,7 +67,7 @@ class Admin::SystemCheck::ElasticsearchCheck < Admin::SystemCheck::BaseCheck
def running_version def running_version
@running_version ||= begin @running_version ||= begin
Chewy.client.info['version']['number'] Chewy.client.info['version']['number']
rescue Faraday::ConnectionFailed, Elasticsearch::Transport::Transport::Error rescue Faraday::ConnectionFailed, Elastic::Transport::Transport::Error
nil nil
end end
end end

View File

@@ -2,7 +2,9 @@
module Elasticsearch module Elasticsearch
module ClientExtensions module ClientExtensions
def verify_elasticsearch def initialize(arguments = {}, &block)
super
@verified = true @verified = true
end end
end end

View File

@@ -115,7 +115,7 @@ module Mastodon::CLI
progress.finish progress.finish
say("Indexed #{added} records, de-indexed #{removed}", :green, true) say("Indexed #{added} records, de-indexed #{removed}", :green, true)
rescue Elasticsearch::Transport::Transport::ServerError => e rescue Elastic::Transport::Transport::ServerError => e
fail_with_message <<~ERROR fail_with_message <<~ERROR
There was an issue connecting to the search server. Make sure the There was an issue connecting to the search server. Make sure the
server is configured and running correctly, and that the environment server is configured and running correctly, and that the environment

View File

@@ -131,7 +131,7 @@ RSpec.describe Admin::SystemCheck::ElasticsearchCheck do
def stub_elasticsearch_error def stub_elasticsearch_error
client = instance_double(Elasticsearch::Client) client = instance_double(Elasticsearch::Client)
allow(client).to receive(:info).and_raise(Elasticsearch::Transport::Transport::Error) allow(client).to receive(:info).and_raise(Elastic::Transport::Transport::Error)
allow(Chewy).to receive(:client).and_return(client) allow(Chewy).to receive(:client).and_return(client)
end end
end end

View File

@@ -0,0 +1,14 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe Elasticsearch::ClientExtensions do
describe '#initialize' do
it 'marks the connection as verified on initialization' do
client = Elasticsearch::Client.new
expect(client.instance_variable_get(:@verified))
.to be(true)
end
end
end

View File

@@ -36,7 +36,7 @@ RSpec.describe Mastodon::CLI::Search do
context 'when server communication raises an error' do context 'when server communication raises an error' do
let(:options) { { reset_chewy: true } } let(:options) { { reset_chewy: true } }
before { allow(Chewy::Stash::Specification).to receive(:reset!).and_raise(Elasticsearch::Transport::Transport::Errors::InternalServerError) } before { allow(Chewy::Stash::Specification).to receive(:reset!).and_raise(Elastic::Transport::Transport::Errors::InternalServerError) }
it 'Exits with error message' do it 'Exits with error message' do
expect { subject } expect { subject }