fix: remove artificial model group concurrency cap

This commit is contained in:
wlx committed 2026-09-29 12:46:10 +08:00
1 parent 25114ca6b8
commit ce0a718686
13 files changed
+165 -34

No files matched your search

@@ -66,6 +66,32 @@ class GatewayDeploymentTest {
verify(redis, atLeastOnce()).execute(any(RedisScript.class), eq(List.of("moyi:test:gateway:slots:key:" + keyId)), any(Object[].class));
}
@Test
void zeroModelConcurrencyUsesOnlyTheIndependentKeyLease() {
StringRedisTemplate redis = mock(StringRedisTemplate.class);
doReturn(1L).when(redis).execute(any(RedisScript.class), anyList(), any(Object[].class));
UUID keyId = UUID.randomUUID();
Map<String, Object> unlimited = Map.of("id", "model-unlimited", "maxConcurrency", 0);
try (GatewayGuard.Admission ignored = new GatewayGuard(redis, 60, 300, 4, 2, 15, 10, "moyi:test:").acquire(unlimited, keyId, 15)) {
// The route is deliberately unlimited at the MOYI model layer.
}
verify(redis, never()).execute(any(RedisScript.class), eq(List.of("moyi:test:gateway:slots:model:model-unlimited")), any(Object[].class));
verify(redis, atLeastOnce()).execute(any(RedisScript.class), eq(List.of("moyi:test:gateway:slots:key:" + keyId)), any(Object[].class));
}
@Test
void disabledModelGuardDoesNotCreateModelLease() {
StringRedisTemplate redis = mock(StringRedisTemplate.class);
doReturn(1L).when(redis).execute(any(RedisScript.class), anyList(), any(Object[].class));
UUID keyId = UUID.randomUUID();
Map<String, Object> model = Map.of("id", "model-measurement", "maxConcurrency", 1);
try (GatewayGuard.Admission ignored = new GatewayGuard(redis, 60, 300, 4, 2, 15, 10, "moyi:test:", true).acquire(model, keyId, 15)) {
// Measurement mode bypasses only the MOYI model-group lease.
}
verify(redis, never()).execute(any(RedisScript.class), eq(List.of("moyi:test:gateway:slots:model:model-measurement")), any(Object[].class));
verify(redis, atLeastOnce()).execute(any(RedisScript.class), eq(List.of("moyi:test:gateway:slots:key:" + keyId)), any(Object[].class));
}
@Test
void modelsExposeReadableIdAndKeepRouteIdForDiagnostics() {
CatalogService catalog = mock(CatalogService.class);