Skip to content

Commit d19883a

Browse files
committed
improves
1 parent 1cb2204 commit d19883a

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

mytoncore/mytoncore.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1504,15 +1504,21 @@ def ElectionEntry(self, args=None):
15041504
def clear_tmp(self):
15051505
start = time.time()
15061506
count = 0
1507+
week_ago = 60 * 60 * 24 * 7
15071508
dir = self.tempDir
15081509
for f in os.listdir(dir):
1509-
ts = f.split('_')[0]
1510-
if ts.isdigit():
1511-
ts = int(ts)
1512-
week = 60 * 60 * 24 * 7
1513-
if ts < time.time() - week:
1510+
prefix = f.split('_')[0]
1511+
if prefix.isdigit():
1512+
ts = int(prefix)
1513+
if ts < time.time() - week_ago:
15141514
count += 1
15151515
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))
1521+
15161522
self.local.add_log(f"Removed {count} old files from tmp dir for {int(time.time() - start)} seconds", "info")
15171523

15181524
def GetValidatorKeyByTime(self, startWorkTime, endWorkTime):

0 commit comments

Comments
 (0)