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] ReconnectErrCB + handler function #1804

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sschleemilch
Copy link

@sschleemilch sschleemilch commented Feb 15, 2025

Hi,

I am often using those connect options due to an offline first approach:

opts := []nats.Option{
    nats.RetryOnFailedConnect(true),
    nats.MaxReconnects(-1),
}

I noticed that none of the current handlers covers handling connection attempt errors when there never was an initial connection with those options.
This is probably a very narrow use case.

That is why I thought adding ReconnectErrCB and the corresponding ReconnectErrHandler makes sense.

Since this is my first contribution, please let me know whether I missed something or whether it should be solved
in a complete different manner. I am willing to put in more work if necessary of course.

Sorry for having a bit of additional diffs due to using gopls formatting. I did not find any formatting rules.
If there are any, I am happy to reformat accordingly.

Regards

@sschleemilch sschleemilch changed the title [ADDED] ReconnectErrCB and AuthErrCB + handler functions [ADDED] ReconnectErrCB + handler function Feb 18, 2025
@piotrpio piotrpio self-requested a review February 20, 2025 13:38
@coveralls
Copy link

Coverage Status

coverage: 84.846% (-0.08%) from 84.922%
when pulling 7a85aa5 on sschleemilch:main
into 7885c8c on nats-io:main.

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.

2 participants