mirror of
https://github.com/python/cpython.git
synced 2025-09-30 20:31:52 +00:00
bpo-30989: Sort in TimedRotatingFileHandler only when needed. (GH-2812) (GH-4466)
TimedRotatingFileHandler.getFilesToDelete() now sorts only when needed.
(cherry picked from commit afad147b59
)
This commit is contained in:
parent
80baec58f5
commit
65dffe58dd
1 changed files with 1 additions and 1 deletions
|
@ -356,10 +356,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…
Add table
Add a link
Reference in a new issue