refactor: streamline event fetching and improve UI table layout

Updated the event fetching logic to utilize Promise.all for concurrent API calls, enhancing performance. Adjusted the UI table layout by modifying the column span for better alignment and presentation of the empty queue state. Introduced constants for maximum events to improve code clarity.
This commit is contained in:
Mauricio Siu
2026-03-03 14:09:46 -06:00
parent edceebec7e
commit af76548482
3 changed files with 9 additions and 11 deletions

View File

@@ -96,11 +96,10 @@ export const deploymentRouter = createTRPCRouter({
where: eq(server.organizationId, orgId),
columns: { serverId: true },
});
rows = [];
for (const { serverId } of servers) {
const serverRows = await fetchDeployApiJobs(serverId);
rows.push(...serverRows);
}
const serverRowsArrays = await Promise.all(
servers.map(({ serverId }) => fetchDeployApiJobs(serverId)),
);
rows = serverRowsArrays.flat();
rows.sort((a, b) => (b.timestamp ?? 0) - (a.timestamp ?? 0));
} else {
const jobs = await myQueue.getJobs();