Skip to content

Commit

Permalink
feat: 执行引擎任务调度配额限制 TencentBlueKing#261
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyu096 committed Jun 27, 2024
1 parent 27b4a1d commit 26cf457
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public class RunningJobResourceQuotaManager {
private static final String METRIC_RUNNING_JOB_RESOURCE_QUOTA_LIMIT_EXCEED_TOTAL =
"job_running_job_resource_quota_limit_exceed_total";

private static final long JOB_EXPIRE_TIME = 14 * 86400 * 1000L;
private static final long JOB_EXPIRE_TIME = 3600 * 1000L;

static {
LUA_SCRIPT_KEYS.add(RUNNING_JOB_ZSET_KEY);
Expand Down Expand Up @@ -220,7 +220,7 @@ public Map<String, Long> getAppRunningJobCount() {
if (countMap.isEmpty()) {
return null;
}
return convertMap(countMap);
return filterEmptyCountAndConvert(countMap);
}

public Map<String, Long> getResourceScopeRunningJobCount() {
Expand All @@ -229,12 +229,18 @@ public Map<String, Long> getResourceScopeRunningJobCount() {
if (countMap.isEmpty()) {
return null;
}
return convertMap(countMap);
return filterEmptyCountAndConvert(countMap);
}

private Map<String, Long> convertMap(Map<String, String> map) {
private Map<String, Long> filterEmptyCountAndConvert(Map<String, String> map) {
Map<String, Long> finalMap = new HashMap<>();
map.forEach((k, v) -> finalMap.put(k, Long.parseLong(v)));
map.forEach((k, v) -> {
long count = Long.parseLong(v);
if (count == 0) {
return;
}
finalMap.put(k, count);
});
return finalMap;
}

Expand Down

0 comments on commit 26cf457

Please sign in to comment.