Commit afad147b authored by Lovesh Harchandani's avatar Lovesh Harchandani Committed by Vinay Sajip

bpo-30989: Sort in TimedRotatingFileHandler only when needed. (GH-2812)

TimedRotatingFileHandler.getFilesToDelete() now sorts only when needed.
parent d609b0c2
...@@ -353,10 +353,10 @@ class TimedRotatingFileHandler(BaseRotatingHandler): ...@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment