increases wait time calculation window

This commit is contained in:
nai-degen 2023-05-22 19:33:03 -05:00
parent a61fa04fbf
commit 26a6e4cadb
2 changed files with 6 additions and 6 deletions

View File

@ -205,7 +205,7 @@ function cleanQueue() {
});
const index = waitTimes.findIndex(
(waitTime) => now - waitTime.end > 90 * 1000
(waitTime) => now - waitTime.end > 300 * 1000
);
const removed = waitTimes.splice(0, index + 1);
log.debug(
@ -234,14 +234,14 @@ export function trackWaitTime(req: Request) {
/** Returns average wait time in milliseconds. */
export function getEstimatedWaitTime() {
const now = Date.now();
const lastMinute = waitTimes.filter((wt) => now - wt.end < 90 * 1000);
if (lastMinute.length === 0) {
const recentWaits = waitTimes.filter((wt) => now - wt.end < 180 * 1000);
if (recentWaits.length === 0) {
return 0;
}
return (
lastMinute.reduce((sum, wt) => sum + wt.end - wt.start, 0) /
lastMinute.length
recentWaits.reduce((sum, wt) => sum + wt.end - wt.start, 0) /
recentWaits.length
);
}

View File

@ -183,7 +183,7 @@ async function setBuildInfo() {
status = status
// ignore Dockerfile changes since that's how the user deploys the app
.split("\n")
.filter((line: string) => !line.endsWith("Dockerfile"));
.filter((line: string) => !line.endsWith("Dockerfile") && line);
const changes = status.length > 0;