Vlad Ghilicica
11/03/2025, 4:02 PMVlad Ghilicica
11/03/2025, 4:02 PMHttpClient(OkHttp) {
engine {
config {
// Use system DNS resolver instead of OkHttp's cached DNS
dns { hostname -> InetAddress.getAllByName(hostname).toList() }
// Reduce connection pool keep-alive time to handle VPN switches better
connectionPool(
ConnectionPool(
maxIdleConnections = 5,
keepAliveDuration = 30,
timeUnit = TimeUnit.SECONDS
)
)
// Force connection retry on connection failure
retryOnConnectionFailure(true)
}
}
}trevjones
11/03/2025, 4:21 PM