Fix "Too many open files" errors when using ElasticSearch

This change sets the Faraday adapter used for ElasticSearch to `:net_http`.

The `elasticsearch-transport` gem tries to auto detect a suitable Faraday
adapter.  Mastodon uses the Faraday default adapter of `:net_http`, but since
`elasticsearch-transport` sees that the `httpclient` gem is available it lets
Faraday use that one.  Unfortunately `httpclient` does not properly clean up
its connections, leading to a lot of established connections to ElasticSearch
over time.

See also: e074fcff9b/lib/elastic/transport/client.rb (L291-L304)

Resolves #18063
This commit is contained in:
Georg Gadinger 2023-09-25 21:02:09 +02:00
parent 17052714a2
commit f37d6637f0
1 changed files with 1 additions and 0 deletions

View File

@ -22,6 +22,7 @@ Chewy.settings = {
number_of_replicas: ['single_node_cluster', nil].include?(ENV['ES_PRESET'].presence) ? 0 : 1,
},
transport_options: transport_options,
adapter: :net_http,
}
# We use our own async strategy even outside the request-response