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

Log connect trace server uri when reconnecting #1106

Merged
merged 6 commits into from
Mar 30, 2024

Conversation

photizzo
Copy link
Contributor

Linked Issue here

.traceConnection()
.timeTraceLogger(l)
.reconnectWait(Duration.ofSeconds(1))
.maxReconnects(1)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Limits the number of reconnect attempts for testing.


try (Connection nc = Nats.connect(options)) {
assertConnected(nc);
ts.close();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Close the test server to trigger a reconnect attempt

try (Connection nc = Nats.connect(options)) {
assertConnected(nc);
ts.close();
Thread.sleep(3000);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Waits for a reconnect attempt to occur

@@ -317,6 +317,7 @@ else if (first.equals(cur)) {
updateStatus(Status.RECONNECTING);

NatsUri resolved = resolvedList.remove(0);
timeTraceLogger.trace("reconnecting to server %s", resolved.toString());
Copy link
Contributor

Choose a reason for hiding this comment

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

To be consistent, this trace should be before the previous line.

@photizzo photizzo requested a review from scottf March 29, 2024 23:52
Copy link
Contributor

@scottf scottf left a comment

Choose a reason for hiding this comment

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

LGTM

@scottf scottf merged commit ea126d6 into nats-io:main Mar 30, 2024
1 check passed
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.

None yet

3 participants