[#746] morph/client: Simplify loop control in iterateClients

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-08-31 13:27:12 +03:00 committed by Alex Vanin
parent 3b7e884e74
commit a2b81f13b0

View file

@ -90,14 +90,13 @@ func (x *multiClient) iterateClients(f func(*Client) error) error {
err = f(c)
}
success := err == nil
if err == nil {
return nil
}
if success || firstErr == nil {
// set first error once
if firstErr == nil {
firstErr = err
if success {
break
}
}
}