-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: re-use existing connection info during force refresh #1441
Conversation
instance.getSslData(); | ||
assertThat(refreshCount.get()).isEqualTo(2); | ||
// refresh count hasn't changed because we re-use the existing connection info | ||
assertThat(refreshCount.get()).isEqualTo(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to add on to this test that forceRefresh() still works. That eventually assertThat(refreshCount.get()).isEqualTo(2);
is true.
When the connector initiates a force refresh, it would previously discard existing connection info and block on the refresh operation completing. In case the cause of the connection failure is transient, we keep the current connection info around and refresh in the background. When the current connection info is in fact invalid, this will cause callers to see additional failures until the refresh completes (usually < 1s).
d1e6430
to
350d227
Compare
@@ -52,91 +51,7 @@ public void initialize(HttpRequest var1) throws IOException { | |||
} | |||
} | |||
|
|||
@Test(timeout = 20000) | |||
public void testThatForceRefreshBalksWhenARefreshIsInProgress() throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this test was built around the old refresh behavior -- where current would block on the next refresh. I need to double check that we have good coverage for balking before I ask for another review.
Thread.sleep(100); | ||
} | ||
|
||
fail(String.format("refresh count should be 2, got = %d", refreshCount.get())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works now.
When the connector initiates a force refresh, it would previously discard existing connection info and block on the refresh operation completing. In case the cause of the connection failure is transient, we keep the current connection info around and refresh in the background. When the current connection info is in fact invalid, this will cause callers to see additional failures until the refresh completes (usually < 1s).
Fixes #1450.