fix(cmd/gc): Run func does not return error when Emit func returns error

License: MIT
Signed-off-by: chenminjian <727180553@qq.com>
This commit is contained in:
chenminjian 2018-10-29 15:49:14 +08:00
parent 46ee56f5fc
commit 78d878e253

View File

@ -83,10 +83,14 @@ order to reclaim hard disk space.
errs := false
for res := range gcOutChan {
if res.Error != nil {
re.Emit(&GcResult{Error: res.Error.Error()})
if err := re.Emit(&GcResult{Error: res.Error.Error()}); err != nil {
return err
}
errs = true
} else {
re.Emit(&GcResult{Key: res.KeyRemoved})
if err := re.Emit(&GcResult{Key: res.KeyRemoved}); err != nil {
return err
}
}
}
if errs {