Fixed substraction order. Previously it gave us a negative duration, so files didn't get deleted.
This commit is contained in:
parent
2c567fd1e5
commit
a0a80db606
@ -81,7 +81,7 @@ func main() {
|
|||||||
var deletedSize int64 = 0
|
var deletedSize int64 = 0
|
||||||
|
|
||||||
for _, entry := range uploadsDir {
|
for _, entry := range uploadsDir {
|
||||||
if time.Duration(entry.ModTime().UTC().Sub(time.Now().UTC())) >= time.Duration(config.Uploads.Limits.KeepForHours)*time.Hour {
|
if time.Now().UTC().Sub(entry.ModTime().UTC()) >= time.Duration(config.Uploads.Limits.KeepForHours)*time.Hour {
|
||||||
if err := os.Remove(path.Join(config.Uploads.Directory, entry.Name())); err != nil {
|
if err := os.Remove(path.Join(config.Uploads.Directory, entry.Name())); err != nil {
|
||||||
logErr.Fatalln("failed to remove file ", entry.Name(), ": ", err)
|
logErr.Fatalln("failed to remove file ", entry.Name(), ": ", err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user