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

Improve node disconnect time #1491

Merged
merged 8 commits into from Jan 9, 2020
Merged

Improve node disconnect time #1491

merged 8 commits into from Jan 9, 2020

Conversation

tadaskay
Copy link
Member

@tadaskay tadaskay commented Jan 8, 2020

Restore connections to broker after connect/disconnect.

Fixes: #1484

Copy link
Contributor

@vkuznecovas vkuznecovas left a comment

Choose a reason for hiding this comment

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

+100000000 for this

communication/nats/connection_wrap.go Outdated Show resolved Hide resolved
communication/nats/connection_wrap.go Outdated Show resolved Hide resolved
communication/nats/connector.go Outdated Show resolved Hide resolved
communication/nats/connector.go Outdated Show resolved Hide resolved
communication/nats/connector.go Show resolved Hide resolved
Copy link
Contributor

@zolia zolia left a comment

Choose a reason for hiding this comment

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

Cool if it works as expected 💯 🥇

This ensures that the broker is reachable. If provider doesn't provide network connectivity,
all calls to the broker will fail, resulting in timeouts. There's a greater chance that it will
work after the disconnect, because the initial connection dialog was established via broker using consumer's
original network interface.
communication/nats/connection_wrap.go Show resolved Hide resolved
communication/nats/connection_wrap.go Outdated Show resolved Hide resolved
communication/nats/connection_wrap.go Show resolved Hide resolved
@codecov-io
Copy link

Codecov Report

Merging #1491 into master will increase coverage by 0.18%.
The diff coverage is 69.38%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1491      +/-   ##
==========================================
+ Coverage   47.63%   47.81%   +0.18%     
==========================================
  Files         282      284       +2     
  Lines       10725    10789      +64     
==========================================
+ Hits         5109     5159      +50     
- Misses       5226     5240      +14     
  Partials      390      390
Impacted Files Coverage Δ
communication/nats/receiver.go 45.94% <100%> (ø) ⬆️
communication/nats/dialog/dialog_establisher.go 89.28% <100%> (+4.8%) ⬆️
communication/nats/connector.go 42.85% <42.85%> (ø)
communication/nats/logger.go 50% <50%> (ø)
communication/nats/connection_wrap.go 93.02% <86.66%> (+21.59%) ⬆️
core/connection/manager.go 83.33% <93.33%> (+0.11%) ⬆️
tequilapi/sse/sse.go 71.11% <0%> (ø) ⬆️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b63e2fb...c3053e3. Read the comment docs.

"github.com/stretchr/testify/assert"
)

func TestBrokerConnector(t *testing.T) {
Copy link
Contributor

@anjmao anjmao Jan 9, 2020

Choose a reason for hiding this comment

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

  1. Would be better to have isolated unit test which doesn't start real nats server. Calling connector.Connect could assert that mock conn Open was called and is added to registry map. Also it could assert that after closing conn it's removed from registry.
  2. ReconnectAll is not tested. Again if mock conn is used it's enough to test if Check method is called.
  3. Tests would be much faster too.

@tadaskay tadaskay merged commit 76db660 into master Jan 9, 2020
@tadaskay tadaskay deleted the 1484-node-slow-disconnect branch January 9, 2020 11:42
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.

Node takes long time to disconnect (openvpn)
7 participants