From 18c49c2cb92f2a260c75580f01710fd2bd2d6273 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 31 Aug 2021 13:29:43 +0300 Subject: [PATCH] [#746] morph/client: Break loop in `iterateClients` on NeoFS error There is no need to continue iterating over Neo RPC endpoints in case of some address-independent error (e.g. NeoFS logic error). Unwrap and immediately return `neofsError` errors from loop in `iterateClients`. Signed-off-by: Leonard Lyubich --- pkg/morph/client/multi.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/morph/client/multi.go b/pkg/morph/client/multi.go index 4b85365685..e7caca6684 100644 --- a/pkg/morph/client/multi.go +++ b/pkg/morph/client/multi.go @@ -94,6 +94,11 @@ func (x *multiClient) iterateClients(f func(*Client) error) error { return nil } + // we dont need to continue the process after the logical error was encountered + if errNeoFS := unwrapNeoFSError(err); errNeoFS != nil { + return errNeoFS + } + // set first error once if firstErr == nil { firstErr = err