diff --git a/src/main/kotlin/com/gabrielfeo/gradle/enterprise/api/Api.kt b/src/main/kotlin/com/gabrielfeo/gradle/enterprise/api/Api.kt index a49d2c20..b0ddcd76 100644 --- a/src/main/kotlin/com/gabrielfeo/gradle/enterprise/api/Api.kt +++ b/src/main/kotlin/com/gabrielfeo/gradle/enterprise/api/Api.kt @@ -33,13 +33,17 @@ var accessToken: () -> String = { } /** - * Shutdown the internal OkHttp client, releasing resources and allowing the program to finish - * before the client's idle timeout. + * Shutdown the internal client, releasing resources and allowing the program to + * finish before the client's idle timeout. * * https://square.github.io/okhttp/4.x/okhttp/okhttp3/-ok-http-client/#shutdown-isnt-necessary */ fun shutdown() { - okHttpClient.dispatcher.executorService.shutdownNow() + okHttpClient.run { + dispatcher.executorService.shutdown() + connectionPool.evictAll(); + cache?.close(); + } } /**