Skip to content

Commit

Permalink
donate-cpu-server.py: added days query parameter to stale report [s…
Browse files Browse the repository at this point in the history
…kip ci}
  • Loading branch information
firewave committed Apr 30, 2024
1 parent 341e118 commit a4e7275
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tools/donate-cpu-server.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,11 @@ def timeoutReport(results_path: str) -> str:
return html


def staleReport(results_path: str) -> str:
def staleReport(results_path: str, query_params: dict) -> str:
thresh_d = query_params.get('days')
if not thresh_d:
thresh_d = 30

html = '<!DOCTYPE html>\n'
html += '<html><head><title>Stale report</title></head><body>\n'
html += '<h1>Stale report</h1>\n'
Expand All @@ -349,7 +353,7 @@ def staleReport(results_path: str) -> str:
datestr = f.readline().strip()
dt = dateTimeFromStr(datestr)
diff = datetime.datetime.now() - dt
if diff.days >= 30:
if diff.days >= thresh_d:
package = pkg_from_file(filename)
html += fmt(package, datestr) + '\n'
html += '</pre>\n'
Expand Down Expand Up @@ -1106,7 +1110,7 @@ def run(self):
html = timeoutReport(self.resultPath)
httpGetResponse(self.connection, html, 'text/html')
elif url == '/stale.html':
html = staleReport(self.resultPath)
html = staleReport(self.resultPath, queryParams)
httpGetResponse(self.connection, html, 'text/html')
elif url == '/diff.html':
html = diffReport(self.resultPath)
Expand Down

0 comments on commit a4e7275

Please sign in to comment.