feat(search): raise NL search rate limit from 5 to 20 req/min
The rule-based NLP service is <100ms vs Ollama's ~15s, making the old limit too restrictive for normal interactive use. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -8,5 +8,5 @@ import org.springframework.stereotype.Component;
|
||||
@ConfigurationProperties("app.nl-search.rate-limit")
|
||||
@Data
|
||||
public class NlSearchRateLimitProperties {
|
||||
private int maxRequestsPerMinute = 5;
|
||||
private int maxRequestsPerMinute = 20;
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ app:
|
||||
|
||||
nl-search:
|
||||
rate-limit:
|
||||
max-requests-per-minute: 5
|
||||
max-requests-per-minute: 20
|
||||
|
||||
ocr:
|
||||
sender-model:
|
||||
|
||||
@@ -138,14 +138,14 @@ class NlSearchControllerTest {
|
||||
.andExpect(jsonPath("$.code").value("SMART_SEARCH_UNAVAILABLE"));
|
||||
}
|
||||
|
||||
// --- 7. 6th request in 1 minute → 429 (rate limit = 5/min default) ---
|
||||
// --- 7. 21st request in 1 minute → 429 (rate limit = 20/min default) ---
|
||||
|
||||
@Test
|
||||
@WithMockUser(username = "user@test.com", authorities = {"READ_ALL"})
|
||||
void search_returns429_onSixthRequestWithinRateLimit() throws Exception {
|
||||
void search_returns429_on21stRequestWithinRateLimit() throws Exception {
|
||||
when(nlQueryParserService.search(anyString(), anyString(), any())).thenReturn(makeResponse());
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
for (int i = 0; i < 20; i++) {
|
||||
mockMvc.perform(post("/api/search/nl").with(csrf())
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content("{\"query\":\"Briefe von Walter\",\"lang\":\"de\"}"))
|
||||
|
||||
Reference in New Issue
Block a user