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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 38 additions and 22 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -17,7 +17,7 @@ class Admin::SystemCheck::ElasticsearchCheck < Admin::SystemCheck::BaseCheck
return true unless Chewy.enabled?
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
end
@ -54,7 +54,7 @@ class Admin::SystemCheck::ElasticsearchCheck < Admin::SystemCheck::BaseCheck
else
Admin::SystemCheck::Message.new(:elasticsearch_preset, nil, 'https://docs.joinmastodon.org/admin/elasticsearch/#scaling')
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)
end
@ -67,7 +67,7 @@ class Admin::SystemCheck::ElasticsearchCheck < Admin::SystemCheck::BaseCheck
def running_version
@running_version ||= begin
Chewy.client.info['version']['number']
rescue Faraday::ConnectionFailed, Elasticsearch::Transport::Transport::Error
rescue Faraday::ConnectionFailed, Elastic::Transport::Transport::Error
nil
end
end

View File

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

View File

@ -115,7 +115,7 @@ module Mastodon::CLI
progress.finish
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
There was an issue connecting to the search server. Make sure the
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
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)
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
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
expect { subject }