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

Add force reconnect #1240

Merged
merged 3 commits into from
Apr 8, 2024
Merged

Add force reconnect #1240

merged 3 commits into from
Apr 8, 2024

Conversation

Jarema
Copy link
Member

@Jarema Jarema commented Apr 5, 2024

reference ADR issue: nats-io/nats-architecture-and-design#259

Signed-off-by: Tomasz Pietrek tomasz@nats.io

async-nats/src/lib.rs Outdated Show resolved Hide resolved
@Jarema Jarema marked this pull request as draft April 5, 2024 14:51
async-nats/src/lib.rs Outdated Show resolved Hide resolved
@Jarema Jarema marked this pull request as ready for review April 5, 2024 17:43
@@ -850,8 +870,6 @@ impl ConnectionHandler {
queue_group: None,
});
}

self.connector.events_tx.try_send(Event::Connected).ok();
Copy link
Contributor

Choose a reason for hiding this comment

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

Who's sending this now?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's sent at the end of successful connect in try_connect.

ExitReason::ReconnectRequested => {
debug!("reconnect requested");
// Should be ok to ingore error, as that means we are not in connected state.
self.connection.stream.shutdown().await.ok();
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't matter with this PR in particular since the problem was always there but this should probably go inside handle_disconnect.

Signed-off-by: Tomasz Pietrek <tomasz@nats.io>
Signed-off-by: Tomasz Pietrek <tomasz@nats.io>
Signed-off-by: Tomasz Pietrek <tomasz@nats.io>
Copy link
Member

@neilalexander neilalexander left a comment

Choose a reason for hiding this comment

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

LGTM

@Jarema Jarema merged commit eea981a into main Apr 8, 2024
11 checks passed
@Jarema Jarema deleted the add-force-reconnect branch April 8, 2024 11:43
Jarema added a commit that referenced this pull request May 6, 2024
# 0.35.0

## Overview

This release makes tls setup more flexible, leveraging rusls v0.23 and allowing to pick crypto backend:
* ring
* aws-lc-rs
* fips

Some other highlights:
* force reconnect via `force_reconnect` method
* explicit create/update consumer API

Thank you for all your contributions!

## Added
* Add `ToServerAddrs` impl for array/vector of strings by @mmalek in #1231
* Add public constructor for Acker by @AbstractiveNord in #1232
* Add force reconnect by @Jarema in #1240
* Add features check by @Jarema in #1247
* Add stream placement by @Jarema in #1250
* Add consumer action by @Jarema in #1254
* Add support for aws-lc-rs (rustls v0.23.0) by @paolobarbolini in #1222

## Fixed
* Use last header value for JetStream messages by @Jarema in #1239

## Changed
* Wrap inbox prefix in an `Arc` by @thomastaylor312 in #1236
* Document feature flags by @Jarema in #1246
* Don't force flush if write buffer isn't empty by @paolobarbolini in #1241

## New Contributors
* @mmalek made their first contribution in #1231

**Full Changelog**: async-nats/v0.34.0...async-nats/v0.35.0



Signed-off-by: Tomasz Pietrek <tomasz@nats.io>
Co-authored-by: Piotr Piotrowski <piotr@synadia.com>
@Jarema Jarema mentioned this pull request May 20, 2024
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.

3 participants