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
  • Loading branch information
firewave committed May 1, 2024
1 parent b8d41bf commit 082117a
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 @@ -363,8 +363,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 082117a

Please sign in to comment.