Skip to content
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] Reconnect wait was not being honored #330

Merged
merged 4 commits into from
Aug 6, 2020

Conversation

ColinSullivan1
Copy link
Member

@ColinSullivan1 ColinSullivan1 commented Aug 3, 2020

The reconnect wait option was not being honored. Adjust the reconnect logic to honor it.

Partially resolves #329.
Resolves #290.

Signed-off-by: Colin Sullivan <colin@synadia.com>
Signed-off-by: Colin Sullivan <colin@synadia.com>
Signed-off-by: Colin Sullivan <colin@synadia.com>
Copy link
Contributor

@matthiashanel matthiashanel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we try to fix this one in the same change? #290
Basically, all other clients behave different and ensure that they wait for reconnect delay before picking the same server again.

if (isDisconnectingOrClosed() || this.isClosing()) {
break;
}

if (server.equals(lastServer)) {
shouldWait = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we manage to connect, should shouldWait be set to false?
line 305

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think so, otherwise it think we wait if we happen to connect to the last server

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, good catch, thanks. I'll fix it, and move the delay up per other comments.

@@ -325,6 +326,11 @@ void reconnect() throws InterruptedException {
if (maxTries > 0 && tries >= maxTries) {
break;
}

if (shouldWait) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this happen inside the for loop? line 318 when we did not succeed or exceed the limits?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is in the while loop, but i could see it going either way for sure

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be cleaner to move it up

@@ -325,6 +326,11 @@ void reconnect() throws InterruptedException {
if (maxTries > 0 && tries >= maxTries) {
break;
}

if (shouldWait) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is in the while loop, but i could see it going either way for sure

@@ -325,6 +326,11 @@ void reconnect() throws InterruptedException {
if (maxTries > 0 && tries >= maxTries) {
break;
}

if (shouldWait) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be cleaner to move it up

if (isDisconnectingOrClosed() || this.isClosing()) {
break;
}

if (server.equals(lastServer)) {
shouldWait = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think so, otherwise it think we wait if we happen to connect to the last server

Signed-off-by: Colin Sullivan <colin@synadia.com>
@ColinSullivan1
Copy link
Member Author

ColinSullivan1 commented Aug 4, 2020

Thanks for the reviews. I moved the check into the loop.

I also moved the test to ReconnectTests.java - didn't notice that set of tests earlier.

@ColinSullivan1
Copy link
Member Author

I have no clue why but can't trigger a re-run for the single flapping CI test. Safe to merge IMO.

Copy link
Contributor

@matthiashanel matthiashanel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also closes #290 as we'll sleep once we went through the entire list once.

@ColinSullivan1 ColinSullivan1 merged commit 76048e9 into master Aug 6, 2020
@ColinSullivan1 ColinSullivan1 deleted the fix-reconnect-wait branch August 6, 2020 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants