[#1609] morph/client: Retry connecting to failed endpoint during the switch

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgenii Stratonikov 2022-07-21 13:38:41 +03:00 committed by fyrchik
parent 7410827db8
commit 30c7925b3c
2 changed files with 1 additions and 5 deletions

View file

@ -13,6 +13,7 @@ Changelog for NeoFS Node
- Require SG members to be unique (#1490) - Require SG members to be unique (#1490)
- `neofs-cli` now doesn't remove container with LOCK objects without `--force` flag (#1500) - `neofs-cli` now doesn't remove container with LOCK objects without `--force` flag (#1500)
- `morph` sections in IR and storage node configuration now accept an address and a priority of an endpoint (#1609) - `morph` sections in IR and storage node configuration now accept an address and a priority of an endpoint (#1609)
- Morph client now retries connecting to the failed endpoint too (#1609)
### Fixed ### Fixed

View file

@ -34,12 +34,7 @@ func (c *Client) switchRPC() bool {
// Iterate endpoints in the order of decreasing priority. // Iterate endpoints in the order of decreasing priority.
// Skip the current endpoint. // Skip the current endpoint.
last := c.endpoints.curr
for c.endpoints.curr = range c.endpoints.list { for c.endpoints.curr = range c.endpoints.list {
if c.endpoints.curr == last {
continue
}
newEndpoint := c.endpoints.list[c.endpoints.curr].Address newEndpoint := c.endpoints.list[c.endpoints.curr].Address
cli, err := newWSClient(c.cfg, newEndpoint) cli, err := newWSClient(c.cfg, newEndpoint)
if err != nil { if err != nil {