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

[ADDED] Force reconnect #1624

Merged
merged 3 commits into from
May 17, 2024
Merged

[ADDED] Force reconnect #1624

merged 3 commits into from
May 17, 2024

Conversation

piotrpio
Copy link
Collaborator

Addresses nats-io/nats-architecture-and-design#259

Signed-off-by: Piotr Piotrowski [email protected]

@piotrpio piotrpio requested review from Jarema and wallyqs April 27, 2024 00:12
@levb
Copy link
Contributor

levb commented May 2, 2024

@piotrpio Reconnect() ignores opts.AllowReconnect, is this by design? (asking for the C client)

Copy link
Member

@Jarema Jarema left a comment

Choose a reason for hiding this comment

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

LGTM

func TestForceReconnect(t *testing.T) {
s := RunDefaultServer()

nc, err := nats.Connect(s.ClientURL(), nats.ReconnectWait(10*time.Second))
Copy link
Member

Choose a reason for hiding this comment

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

Only one behavior that wanted to confirm is whether we get an error on disconnect or not, and it seems the disconnect callback is called but without an error which I think it is good, e.g.

nats.DisconnectErrHandler(func(_ *nats.Conn, err error) {
	t.Logf("ERROR: %v", err) // error is nil here
}),

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, the callback is invoked without error which I thought is a reasonable behavior.

Copy link
Member

@wallyqs wallyqs left a comment

Choose a reason for hiding this comment

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

LGTM

@piotrpio piotrpio merged commit 364bbef into main May 17, 2024
2 checks passed
@piotrpio piotrpio deleted the force-reconnect branch May 17, 2024 07:37
@piotrpio piotrpio mentioned this pull request May 17, 2024
piotrpio added a commit that referenced this pull request Aug 15, 2024
Signed-off-by: Piotr Piotrowski <[email protected]>
piotrpio added a commit that referenced this pull request Aug 15, 2024
Signed-off-by: Piotr Piotrowski <[email protected]>
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.

4 participants