Skip to content

Commit

Permalink
donate-cpu-server.py: added handling of potentially invalid timestamp…
Browse files Browse the repository at this point in the history
…s in stale report [skip ci]
  • Loading branch information
firewave committed Apr 30, 2024
1 parent ddb7758 commit 5dc4e8b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tools/donate-cpu-server.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,12 @@ def staleReport(results_path: str, query_params: dict) -> str:
with open(filename, 'rt') as f:
# first line is datetime string
datestr = f.readline().strip()
dt = dateTimeFromStr(datestr)
diff = datetime.datetime.now() - dt
try:
dt = dateTimeFromStr(datestr)
diff = datetime.datetime.now() - dt
except:
# there might be very outdated files which still might have an invalid timestamp
diff = datetime.timedelta(days=thresh_d)
if diff.days >= thresh_d:
package = pkg_from_file(filename)
html += fmt(package, datestr) + '\n'
Expand Down

0 comments on commit 5dc4e8b

Please sign in to comment.