Skip to content

Commit e8d4447

Browse files
committed
Merge remote-tracking branch 'origin/main' into samejr/Settings-page-layouts
2 parents 540fcf6 + d91818f commit e8d4447

5 files changed

Lines changed: 11 additions & 455 deletions

File tree

.github/workflows/dependabot-critical-alerts.yml

Lines changed: 0 additions & 87 deletions
This file was deleted.

.github/workflows/dependabot-weekly-summary.yml

Lines changed: 0 additions & 210 deletions
This file was deleted.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
area: webapp
3+
type: fix
4+
---
5+
6+
The tasks page no longer runs two queries whose results were never displayed, cutting wasted work on every page load and removing a source of hidden server errors

apps/webapp/app/presenters/v3/TaskListPresenter.server.ts

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@ import {
66
import { $replica } from "~/db.server";
77
import { clickhouseFactory } from "~/services/clickhouse/clickhouseFactoryInstance.server";
88
import {
9-
type AverageDurations,
109
ClickHouseEnvironmentMetricsRepository,
1110
type CurrentRunningStats,
12-
type DailyTaskActivity,
1311
} from "~/services/environmentMetricsRepository.server";
1412
import { singleton } from "~/utils/singleton";
1513
import { findCurrentWorkerFromEnvironment } from "~/v3/models/workerDeployment.server";
@@ -21,8 +19,6 @@ export type TaskListItem = {
2119
triggerSource: TaskTriggerSource;
2220
};
2321

24-
export type TaskActivity = DailyTaskActivity[string];
25-
2622
export class TaskListPresenter {
2723
constructor(private readonly _replica: PrismaClientOrTransaction) {}
2824

@@ -55,9 +51,7 @@ export class TaskListPresenter {
5551
if (!currentWorker) {
5652
return {
5753
tasks: [],
58-
activity: Promise.resolve({} as DailyTaskActivity),
5954
runningStats: Promise.resolve({} as CurrentRunningStats),
60-
durations: Promise.resolve({} as AverageDurations),
6155
};
6256
}
6357

@@ -89,16 +83,10 @@ export class TaskListPresenter {
8983
clickhouse,
9084
});
9185

92-
// IMPORTANT: Don't await these, we want to return the promises
93-
// so we can defer the loading of the data
94-
const activity = environmentMetricsRepository.getDailyTaskActivity({
95-
organizationId,
96-
projectId,
97-
environmentId,
98-
days: 6, // This actually means 7 days, because we want to show the current day too
99-
tasks: slugs,
100-
});
101-
86+
// IMPORTANT: Don't await this, we want to return the promise
87+
// so we can defer the loading of the data. The caller is responsible for
88+
// consuming it — an unconsumed promise here would become an unhandled
89+
// rejection if the underlying query fails.
10290
const runningStats = environmentMetricsRepository.getCurrentRunningStats({
10391
organizationId,
10492
projectId,
@@ -107,15 +95,7 @@ export class TaskListPresenter {
10795
tasks: slugs,
10896
});
10997

110-
const durations = environmentMetricsRepository.getAverageDurations({
111-
organizationId,
112-
projectId,
113-
environmentId,
114-
days: 6,
115-
tasks: slugs,
116-
});
117-
118-
return { tasks, activity, runningStats, durations };
98+
return { tasks, runningStats };
11999
}
120100
}
121101

0 commit comments

Comments
 (0)