From fac02941972f3c7a13fa95680907177998e1ecbe Mon Sep 17 00:00:00 2001 From: vinny Date: Wed, 8 Jan 2025 14:51:36 -0500 Subject: [PATCH 1/2] HARMONY-1971: Address slow query for jobs+labels --- services/harmony/app/frontends/jobs.ts | 2 +- services/harmony/app/frontends/workflow-ui.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/services/harmony/app/frontends/jobs.ts b/services/harmony/app/frontends/jobs.ts index 18967c66e..ae1edddf6 100644 --- a/services/harmony/app/frontends/jobs.ts +++ b/services/harmony/app/frontends/jobs.ts @@ -126,7 +126,7 @@ export async function getJobsListing( req.context.logger.info(`Get jobs listing for user ${req.user}`); const root = getRequestRoot(req); const { page, limit } = getPagingParams(req, env.defaultJobListPageSize); - const query: JobQuery = { where: {} }; + const query: JobQuery = { where: {}, orderBy: { field: 'jobs.id', value: 'asc' } }; query.labels = req.body.label; if (!req.context.isAdminAccess) { diff --git a/services/harmony/app/frontends/workflow-ui.ts b/services/harmony/app/frontends/workflow-ui.ts index 69f37c859..0204c7d0e 100644 --- a/services/harmony/app/frontends/workflow-ui.ts +++ b/services/harmony/app/frontends/workflow-ui.ts @@ -260,7 +260,7 @@ function jobRenderingFunctions(logger: Logger, requestQuery: Record * @returns JobQuery */ function tableQueryToJobQuery(tableQuery: TableQuery, isAdmin: boolean, user: string, jobIDs?: string[]): JobQuery { - const jobQuery: JobQuery = { where: {}, whereIn: {} }; + const jobQuery: JobQuery = { where: {}, whereIn: {}, orderBy: { field: 'jobs.id', value: 'desc' } }; if (tableQuery.sortGranules) { jobQuery.orderBy = { field: 'numInputGranules', From 30a0239b29f968bd164cf0da3ab0f6c6325ebd04 Mon Sep 17 00:00:00 2001 From: vinny Date: Wed, 8 Jan 2025 14:54:10 -0500 Subject: [PATCH 2/2] HARMONY-1971: Fix typo: asc => desc --- services/harmony/app/frontends/jobs.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/harmony/app/frontends/jobs.ts b/services/harmony/app/frontends/jobs.ts index ae1edddf6..eec1d54fb 100644 --- a/services/harmony/app/frontends/jobs.ts +++ b/services/harmony/app/frontends/jobs.ts @@ -126,7 +126,7 @@ export async function getJobsListing( req.context.logger.info(`Get jobs listing for user ${req.user}`); const root = getRequestRoot(req); const { page, limit } = getPagingParams(req, env.defaultJobListPageSize); - const query: JobQuery = { where: {}, orderBy: { field: 'jobs.id', value: 'asc' } }; + const query: JobQuery = { where: {}, orderBy: { field: 'jobs.id', value: 'desc' } }; query.labels = req.body.label; if (!req.context.isAdminAccess) {