From 9543711f88494d617cadae31d43da3d2accc21b9 Mon Sep 17 00:00:00 2001 From: wangyu096 Date: Mon, 24 Jun 2024 17:51:33 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=89=A7=E8=A1=8C=E5=BC=95=E6=93=8E?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E8=B0=83=E5=BA=A6=E9=85=8D=E9=A2=9D=E9=99=90?= =?UTF-8?q?=E5=88=B6=20#261?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inner/ServiceResourceQuotaResourceImpl.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/inner/ServiceResourceQuotaResourceImpl.java b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/inner/ServiceResourceQuotaResourceImpl.java index 5c5701840d..22f5bb9ae0 100644 --- a/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/inner/ServiceResourceQuotaResourceImpl.java +++ b/src/backend/job-execute/service-job-execute/src/main/java/com/tencent/bk/job/execute/api/inner/ServiceResourceQuotaResourceImpl.java @@ -24,6 +24,7 @@ package com.tencent.bk.job.execute.api.inner; +import com.tencent.bk.job.common.exception.InternalException; import com.tencent.bk.job.common.model.InternalResponse; import com.tencent.bk.job.common.resource.quota.ResourceQuotaLimit; import com.tencent.bk.job.common.service.quota.ResourceQuotaStore; @@ -55,10 +56,16 @@ public InternalResponse> getResourceQuotaConfig( @Override public InternalResponse getRunningJobQuotaUsage() { - RunningJobQuotaUsage runningJobQuotaUsage = new RunningJobQuotaUsage(); - runningJobQuotaUsage.setTotal(runningJobResourceQuotaManager.getRunningJobTotal()); - runningJobQuotaUsage.setAppCount(runningJobResourceQuotaManager.getAppRunningJobCount()); - runningJobQuotaUsage.setResourceScopeCount(runningJobResourceQuotaManager.getResourceScopeRunningJobCount()); - return InternalResponse.buildSuccessResp(runningJobQuotaUsage); + try { + RunningJobQuotaUsage runningJobQuotaUsage = new RunningJobQuotaUsage(); + runningJobQuotaUsage.setTotal(runningJobResourceQuotaManager.getRunningJobTotal()); + runningJobQuotaUsage.setAppCount(runningJobResourceQuotaManager.getAppRunningJobCount()); + runningJobQuotaUsage.setResourceScopeCount(runningJobResourceQuotaManager.getResourceScopeRunningJobCount()); + return InternalResponse.buildSuccessResp(runningJobQuotaUsage); + } catch (Throwable e) { + log.error("GetRunningJobQuotaUsage error", e); + return InternalResponse.buildCommonFailResp(new InternalException("GetRunningJobQuotaUsage error", e)); + } + } }