nats-io / stan.go

NATS Streaming System
https://nats.io
Apache License 2.0
706 stars 117 forks source link

[ADDED] AllowCloseRetry option #363

Closed kozlovic closed 2 years ago

kozlovic commented 2 years ago

In PR #360, we changed the default behavior of connection Close() in that if the library failed to sent the close protocol or received its response, the Close() could be retried. In order to do that, the underlying NATS connection would not be closed.

This has side-effects in that the NATS connection would be left opened or possibly reconnect when an user would have previously called Close(), not check error, and expect NATS connection to be closed.

The introduction of this option allow the default behavior to remain the same, and users that do want to be able to call Close() again on a failed call will need to set this option when creating the connection.

Signed-off-by: Ivan Kozlovic ivan@synadia.com

coveralls commented 2 years ago

Coverage Status

Coverage increased (+0.08%) to 92.954% when pulling f27faca16b7a2283816f544ae196cb6acc402ef5 on retry_close_option into 9937a129ca9e5a07a569ddd15f7d1e4b3d399b38 on main.