File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change 2626package algolia
2727
2828import java .util .concurrent .ExecutionException
29-
3029import algolia .http ._
30+ import io .netty .channel .EventLoop
3131import io .netty .channel .nio .NioEventLoopGroup
3232import io .netty .channel .socket .nio .NioDatagramChannel
3333import io .netty .resolver .dns .{DnsNameResolver , DnsNameResolverBuilder }
@@ -52,8 +52,9 @@ case class AlgoliaHttpClient(
5252 .setUseProxyProperties(configuration.useSystemProxy)
5353 .build
5454
55+ val dnsEventLoop : EventLoop = new NioEventLoopGroup (1 ).next()
5556 val dnsNameResolver : DnsNameResolver =
56- new DnsNameResolverBuilder (new NioEventLoopGroup ( 1 ).next() ) // We only need 1 thread for DNS resolution
57+ new DnsNameResolverBuilder (dnsEventLoop ) // We only need 1 thread for DNS resolution
5758 .channelType(classOf [NioDatagramChannel ])
5859 .queryTimeoutMillis(configuration.dnsTimeoutMs.toLong)
5960 .maxQueriesPerResolve(2 )
@@ -67,6 +68,7 @@ case class AlgoliaHttpClient(
6768
6869 def close (): Unit = {
6970 dnsNameResolver.close()
71+ dnsEventLoop.shutdownGracefully()
7072 _httpClient.close()
7173 }
7274
You can’t perform that action at this time.
0 commit comments