fix: remove artificial model group concurrency cap
This commit is contained in:
1 parent
25114ca6b8
commit
ce0a718686
13 files changed
+165
-34
No files matched your search
@@ -129,6 +129,7 @@ public class UsageAuditService {
|
||||
"LEFT JOIN usage_events ue ON ue.deleted_at IS NULL AND ue.created_at >= day AND ue.created_at < day + INTERVAL '1 day' " +
|
||||
"GROUP BY day ORDER BY day",
|
||||
(rs, row) -> Map.of("date", rs.getString("day"), "count", rs.getLong("count"))));
|
||||
boolean modelGuardEnabled = gatewayGuard == null || gatewayGuard.modelConcurrencyEnabled();
|
||||
int defaultModelLimit = gatewayGuard == null ? 4 : gatewayGuard.defaultModelConcurrency();
|
||||
List<Map<String, Object>> groups = jdbc.query("""
|
||||
WITH pending AS (
|
||||
@@ -138,7 +139,8 @@ public class UsageAuditService {
|
||||
FROM model_tasks WHERE status IN ('queued','running') GROUP BY model_id
|
||||
)
|
||||
SELECT m.id, m.public_name, m.source_label, p.name AS provider_name, m.call_mode,
|
||||
COALESCE(NULLIF(m.max_concurrency, 0), ?) AS max_concurrency,
|
||||
CASE WHEN m.max_concurrency = 0 THEN 0
|
||||
ELSE COALESCE(m.max_concurrency, ?) END AS max_concurrency,
|
||||
(m.status='active' AND m.deleted_at IS NULL AND p.status='active' AND p.deleted_at IS NULL
|
||||
AND d.status='active' AND d.deleted_at IS NULL) AS route_enabled,
|
||||
COALESCE(pending.running, 0) AS running, COALESCE(pending.queued, 0) AS queued
|
||||
@@ -155,7 +157,7 @@ public class UsageAuditService {
|
||||
group.put("providerName", rs.getString("provider_name"));
|
||||
group.put("mode", rs.getString("call_mode"));
|
||||
group.put("routeEnabled", rs.getBoolean("route_enabled"));
|
||||
group.put("limit", rs.getInt("max_concurrency"));
|
||||
group.put("limit", modelGuardEnabled ? rs.getInt("max_concurrency") : 0);
|
||||
group.put("running", rs.getLong("running"));
|
||||
group.put("queued", rs.getLong("queued"));
|
||||
return group;
|
||||
@@ -179,6 +181,7 @@ public class UsageAuditService {
|
||||
"queueWaitMs", gatewayGuard == null ? 30000 : gatewayGuard.queueWaitMs(),
|
||||
"defaultModelConcurrency", defaultModelLimit,
|
||||
"defaultKeyConcurrency", gatewayGuard == null ? 4 : gatewayGuard.defaultKeyConcurrency(),
|
||||
"modelConcurrencyGuardEnabled", gatewayGuard == null || gatewayGuard.modelConcurrencyEnabled(),
|
||||
"asyncQueueLimit", asyncQueueLimit,
|
||||
"asyncWorkerIntervalMs", asyncWorkerIntervalMs,
|
||||
"synchronousSnapshotAvailable", snapshot.available()
|
||||
|
||||
Reference in new issue
Block a user