diff --git a/.ldrelease/secrets.properties b/.ldrelease/secrets.properties index 9189ccaa..048742d2 100644 --- a/.ldrelease/secrets.properties +++ b/.ldrelease/secrets.properties @@ -5,7 +5,7 @@ android_code_signing_keyring=blob:/android/code-signing-keyring.gpg android_code_signing_passphrase=param:/production/common/releasing/android_code_signing/private_key_passphrase # Username for the Sonatype repository. -android_sonatype_username=param:/global/services/sonatype/username +android_sonatype_username=param:/production/common/releasing/sonatype/username # Password for the Sonatype repository. -android_sonatype_password=param:/global/services/sonatype/password +android_sonatype_password=param:/production/common/releasing/sonatype/password diff --git a/CHANGELOG.md b/CHANGELOG.md index 422dce25..ad44bc00 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,11 @@ # Change log - All notable changes to the LaunchDarkly Android SDK will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org). +## [3.5.1] - 2023-01-06 +### Fixed: +- The fix for unnecessarily long-lived polling connections in the [3.2.2](https://github.com/launchdarkly/android-client-sdk/releases/tag/3.2.2) release was incomplete: rather than turning off the keep-alive behavior, it only reduced it from 10 minutes to 5 minutes. It should now close the connection immediately after each request as intended. + ## [4.1.0] - 2022-12-22 ### Added: - `StreamingDataSourceBuilder.streamEvenInBackground`, an option for allowing the SDK to maintain a streaming data connection even when the application is in the background. diff --git a/launchdarkly-android-client-sdk/src/main/java/com/launchdarkly/sdk/android/HttpFeatureFlagFetcher.java b/launchdarkly-android-client-sdk/src/main/java/com/launchdarkly/sdk/android/HttpFeatureFlagFetcher.java index 8626b926..eca1c9c3 100644 --- a/launchdarkly-android-client-sdk/src/main/java/com/launchdarkly/sdk/android/HttpFeatureFlagFetcher.java +++ b/launchdarkly-android-client-sdk/src/main/java/com/launchdarkly/sdk/android/HttpFeatureFlagFetcher.java @@ -13,9 +13,11 @@ import java.io.File; import java.io.IOException; import java.net.URI; +import java.util.concurrent.TimeUnit; import okhttp3.Cache; import okhttp3.Call; +import okhttp3.ConnectionPool; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.RequestBody; @@ -57,6 +59,11 @@ class HttpFeatureFlagFetcher implements FeatureFetcher { // if there are multiple environments; right now a new HTTP client is being created for // polling for each environment, even though they all have the same configuration. .cache(new Cache(cacheDir, MAX_CACHE_SIZE_BYTES)) + .connectionPool(new ConnectionPool(0, 1, TimeUnit.MILLISECONDS)) + // We want a new connection each time, because keeping an idle connection alive + // could cause an unwanted wakeup due to connection-cleanup network traffic if + // it expires while the app is in the background. If we did not call + // .connectionPool() at all, OkHttp would default to a pool of non-zero size. .retryOnConnectionFailure(true) .build(); }