Skip to content

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 (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.

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

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

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 (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

Development

Successfully merging this pull request may close these issues.

Issue in discovered server list in case of DNS entry Reconnect wait logic in java only waits if the current and last server tried are the same

4 participants