1
0
mirror of https://github.com/mastodon/mastodon synced 2024-11-24 07:06:18 +09:00

Fix Elastic check deprecation warning about gem version (#27262)

This commit is contained in:
Matt Jankowski 2023-10-03 09:52:47 -04:00 committed by GitHub
parent 85db392464
commit 2f8f92df48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -76,14 +76,35 @@ class Admin::SystemCheck::ElasticsearchCheck < Admin::SystemCheck::BaseCheck
end
def compatible_version?
return false if running_version.nil?
Gem::Version.new(running_version) >= Gem::Version.new(required_version) ||
Gem::Version.new(compatible_wire_version) >= Gem::Version.new(required_version)
running_version_ok? || compatible_wire_version_ok?
rescue ArgumentError
false
end
def running_version_ok?
return false if running_version.blank?
gem_version_running >= gem_version_required
end
def compatible_wire_version_ok?
return false if compatible_wire_version.blank?
gem_version_compatible_wire >= gem_version_required
end
def gem_version_running
Gem::Version.new(running_version)
end
def gem_version_required
Gem::Version.new(required_version)
end
def gem_version_compatible_wire
Gem::Version.new(compatible_wire_version)
end
def mismatched_indexes
@mismatched_indexes ||= INDEXES.filter_map do |klass|
klass.base_name if Chewy.client.indices.get_mapping[klass.index_name]&.deep_symbolize_keys != klass.mappings_hash