1
0

Fixed substraction order. Previously it gave us a negative duration, so files didn't get deleted.

This commit is contained in:
Alexander Andreev 2022-02-10 23:04:27 +04:00
parent 2c567fd1e5
commit a0a80db606
Signed by: Arav
GPG Key ID: 1327FE8A374CC86F

View File

@ -81,7 +81,7 @@ func main() {
var deletedSize int64 = 0
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 {
logErr.Fatalln("failed to remove file ", entry.Name(), ": ", err)
}