[#746] morph/client: Simplify loop control in iterateClients
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
3b7e884e74
commit
a2b81f13b0
1 changed files with 5 additions and 6 deletions
|
@ -90,14 +90,13 @@ func (x *multiClient) iterateClients(f func(*Client) error) error {
|
||||||
err = f(c)
|
err = f(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
success := err == nil
|
if err == nil {
|
||||||
|
return nil
|
||||||
if success || firstErr == nil {
|
|
||||||
firstErr = err
|
|
||||||
|
|
||||||
if success {
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set first error once
|
||||||
|
if firstErr == nil {
|
||||||
|
firstErr = err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue