bpo-30989: Sort in TimedRotatingFileHandler only when needed. (GH-2812)
TimedRotatingFileHandler.getFilesToDelete() now sorts only when needed.
This commit is contained in:
parent
d609b0c24e
commit
afad147b59
|
@ -353,10 +353,10 @@ class TimedRotatingFileHandler(BaseRotatingHandler):
|
||||||
suffix = fileName[plen:]
|
suffix = fileName[plen:]
|
||||||
if self.extMatch.match(suffix):
|
if self.extMatch.match(suffix):
|
||||||
result.append(os.path.join(dirName, fileName))
|
result.append(os.path.join(dirName, fileName))
|
||||||
result.sort()
|
|
||||||
if len(result) < self.backupCount:
|
if len(result) < self.backupCount:
|
||||||
result = []
|
result = []
|
||||||
else:
|
else:
|
||||||
|
result.sort()
|
||||||
result = result[:len(result) - self.backupCount]
|
result = result[:len(result) - self.backupCount]
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue