Skip to content
Draft
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ public void onError(Throwable t) {
if (code >= 400 && code < 500) {
logger.error("Encountered non-retriable error: {}. Aborting connection to stream. Verify correct Mobile Key and Stream URI", code);
running = false;
resultCallback.onError(new LDInvalidResponseCodeFailure("Unexpected Response Code From Stream Connection", t, code, false));
if (code == 401) {
connection401Error = true;
dataSourceUpdateSink.shutDown();
}
resultCallback.onError(new LDInvalidResponseCodeFailure("Unexpected Response Code From Stream Connection", t, code, false));
stop(null);
} else {
eventSourceStarted = System.currentTimeMillis();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -617,13 +617,6 @@ public void startWithHttp401ShutsDownSink() throws Exception {
LDInvalidResponseCodeFailure failure = (LDInvalidResponseCodeFailure) error;
assertEquals(401, failure.getResponseCode());
assertFalse(failure.isRetryable());
// The background thread calls resultCallback.onError() before
// dataSourceUpdateSink.shutDown(), so shutDownCalled may not be true yet.
// Poll briefly to allow the background thread to complete.
long deadline = System.currentTimeMillis() + 1000;
while (!dataSourceUpdateSink.shutDownCalled && System.currentTimeMillis() < deadline) {
Thread.sleep(10);
}
assertTrue(dataSourceUpdateSink.shutDownCalled);
}
}
Expand Down
Loading