Skip to content

Commit

Permalink
bpo-30989: Sort in TimedRotatingFileHandler only when needed. (GH-2812)…
Browse files Browse the repository at this point in the history
… (GH-4466)

TimedRotatingFileHandler.getFilesToDelete() now sorts only when needed.
(cherry picked from commit afad147)
  • Loading branch information
miss-islington authored and vsajip committed Nov 19, 2017
1 parent 80baec5 commit 65dffe5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Lib/logging/handlers.py
Expand Up @@ -356,10 +356,10 @@ def getFilesToDelete(self):
suffix = fileName[plen:]
if self.extMatch.match(suffix):
result.append(os.path.join(dirName, fileName))
result.sort()
if len(result) < self.backupCount:
result = []
else:
result.sort()
result = result[:len(result) - self.backupCount]
return result

Expand Down

0 comments on commit 65dffe5

Please sign in to comment.