Not deleting files if the number of files is less than max files

This commit is contained in:
Diptanu Choudhury 2016-03-29 16:42:18 -07:00
parent 3b2b3f95ca
commit b55254ba0a

View file

@ -238,6 +238,12 @@ func (f *FileRotator) purgeOldFiles() {
}
}
// not continuing to delete files if the number of files is not more
// than MaxFiles
if len(fIndexes) <= f.MaxFiles {
continue
}
// Sorting the file indexes so that we can purge the older files and keep
// only the number of files as configured by the user
sort.Sort(sort.IntSlice(fIndexes))