Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/sdk/server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ ext.versions = [
"launchdarklyJavaSdkInternal": "1.6.1",
"launchdarklyLogging": "1.1.0",
"okhttp": "4.12.0", // specify this for the SDK build instead of relying on the transitive dependency from okhttp-eventsource
"okhttpEventsource": "4.1.0",
"okhttpEventsource": "4.2.0",
"reactorCore":"3.3.22.RELEASE",
"slf4j": "1.7.36",
"snakeyaml": "2.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
import com.launchdarkly.logging.LDLogger;
import com.launchdarkly.sdk.internal.fdv2.payloads.FDv2Event;
import com.launchdarkly.sdk.internal.fdv2.sources.Selector;
import com.launchdarkly.sdk.internal.http.HttpErrors;
import com.launchdarkly.sdk.internal.http.HttpHelpers;
import com.launchdarkly.sdk.internal.http.HttpProperties;
import com.launchdarkly.sdk.json.SerializationException;

import okhttp3.Call;
import okhttp3.Callback;
Expand Down Expand Up @@ -116,14 +114,12 @@ public void onResponse(@Nonnull Call call, @Nonnull Response response) {
// Handle 304 Not Modified - no new data
if (response.code() == 304) {
logger.debug("FDv2 polling request returned 304: not modified");
future.complete(null);
future.complete(FDv2PayloadResponse.none(response.code()));
return;
}

if (!response.isSuccessful()) {
future.completeExceptionally(
new HttpErrors.HttpErrorException(response.code())
);
future.complete(FDv2PayloadResponse.failure(response.code(), response.headers()));
return;
}

Expand All @@ -145,7 +141,7 @@ public void onResponse(@Nonnull Call call, @Nonnull Response response) {
List<FDv2Event> events = FDv2Event.parseEventsArray(responseBody);

// Create and return the response
FDv2PayloadResponse pollingResponse = new FDv2PayloadResponse(events, response.headers());
FDv2PayloadResponse pollingResponse = FDv2PayloadResponse.success(events, response.headers(), response.code());
future.complete(pollingResponse);

} catch (Exception e) {
Expand Down
Loading