[#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)
|
||||
}
|
||||
|
||||
success := err == nil
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
if success || firstErr == nil {
|
||||
// set first error once
|
||||
if firstErr == nil {
|
||||
firstErr = err
|
||||
|
||||
if success {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue