fileutil: return on error and send it to error chan
parent
e2c2f098bc
commit
dc87454487
|
@ -57,10 +57,14 @@ func PurgeFile(dirname string, suffix string, max uint, interval time.Duration,
|
||||||
err = l.Unlock()
|
err = l.Unlock()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
plog.Errorf("error unlocking %s when purging file (%v)", l.Name(), err)
|
plog.Errorf("error unlocking %s when purging file (%v)", l.Name(), err)
|
||||||
|
errC <- err
|
||||||
|
return
|
||||||
}
|
}
|
||||||
err = l.Destroy()
|
err = l.Destroy()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
plog.Errorf("error destroying lock %s when purging file (%v)", l.Name(), err)
|
plog.Errorf("error destroying lock %s when purging file (%v)", l.Name(), err)
|
||||||
|
errC <- err
|
||||||
|
return
|
||||||
}
|
}
|
||||||
plog.Infof("purged file %s successfully", f)
|
plog.Infof("purged file %s successfully", f)
|
||||||
newfnames = newfnames[1:]
|
newfnames = newfnames[1:]
|
||||||
|
|
Loading…
Reference in New Issue