Skip to content

Commit cbdd56c

Browse files
committed
improves
1 parent d19883a commit cbdd56c

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

mytoncore/mytoncore.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1507,17 +1507,10 @@ def clear_tmp(self):
15071507
week_ago = 60 * 60 * 24 * 7
15081508
dir = self.tempDir
15091509
for f in os.listdir(dir):
1510-
prefix = f.split('_')[0]
1511-
if prefix.isdigit():
1512-
ts = int(prefix)
1513-
if ts < time.time() - week_ago:
1514-
count += 1
1515-
os.remove(os.path.join(dir, f))
1516-
elif prefix == 'checkload':
1517-
ts = int(f.split('_')[1])
1518-
if ts < time.time() - week_ago:
1519-
count += 1
1520-
os.remove(os.path.join(dir, f))
1510+
ts = os.path.getmtime(os.path.join(dir, f))
1511+
if ts < time.time() - week_ago:
1512+
count += 1
1513+
os.remove(os.path.join(dir, f))
15211514

15221515
self.local.add_log(f"Removed {count} old files from tmp dir for {int(time.time() - start)} seconds", "info")
15231516

0 commit comments

Comments
 (0)