mirror of
https://github.com/mastodon/mastodon.git
synced 2026-09-08 18:25:49 -05:00
Fix Elasticsearch connection cleanup in Sidekiq middleware (#39359)
This commit is contained in:
@@ -34,7 +34,7 @@ class Mastodon::SidekiqMiddleware
|
||||
# and each such client manages its long-lasting connection to
|
||||
# Elasticsearch.
|
||||
#
|
||||
# As far as I know, neither `chewy`, `elasticsearch-transport` or even
|
||||
# As far as I know, neither `chewy`, `elastic-transport` or even
|
||||
# `faraday` provide a reliable way to immediately close a connection, and
|
||||
# rely on the underlying object to be garbage-collected instead.
|
||||
#
|
||||
@@ -44,7 +44,7 @@ class Mastodon::SidekiqMiddleware
|
||||
def clean_up_elasticsearch_connections!
|
||||
return unless Chewy.enabled? && Chewy.current[:chewy_client].present?
|
||||
|
||||
Chewy.client.transport.transport.connections.each do |connection|
|
||||
Chewy.client.transport.connections.each do |connection|
|
||||
# NOTE: This bit of code is tailored for the HTTPClient Faraday adapter
|
||||
connection.connection.app.instance_variable_get(:@client)&.reset_all
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user