use iterator to loop over first 1000 entries (#2359)
parent
c5e2d0cd61
commit
47dfa52456
|
@ -49,7 +49,7 @@ if __name__ == "__main__":
|
|||
|
||||
if sm.updated['thermal']:
|
||||
t = sm['thermal']
|
||||
last_temp = np.mean([t.cpu0, t.cpu1, t.cpu2, t.cpu3]) / 10.
|
||||
last_temp = np.mean(t.cpu)
|
||||
last_mem = t.memUsedPercent
|
||||
|
||||
if sm.updated['procLog']:
|
||||
|
|
|
@ -17,10 +17,12 @@ def get_tombstones():
|
|||
files = []
|
||||
for folder in ["/data/tombstones/", "/var/crash/"]:
|
||||
if os.path.exists(folder):
|
||||
for fn in os.listdir(folder):
|
||||
if fn.startswith("tombstone") or fn.endswith(".crash"):
|
||||
path = os.path.join(folder, fn)
|
||||
files.append((path, int(os.stat(path).st_ctime)))
|
||||
with os.scandir(folder) as d:
|
||||
|
||||
# Loop over first 1000 directory entries
|
||||
for _, f in zip(range(1000), d):
|
||||
if f.name.startswith("tombstone") or f.name.endswith(".crash"):
|
||||
files.append((f.path, int(f.stat().st_ctime)))
|
||||
return files
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue