Skip to content

Commit cd94c34

Browse files
authored
Script: Disable compilation rate limit in general cache for tests (#79862) (#79865)
`script.disable_max_compilations_rate` was not respected for the general cache, only the context caches. Fixes: #79720
1 parent 6261e7d commit cd94c34

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

server/src/main/java/org/elasticsearch/script/ScriptService.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -592,8 +592,12 @@ void setCacheHolder(Settings settings) {
592592
}
593593

594594
CacheHolder generalCacheHolder(Settings settings) {
595-
return new CacheHolder(SCRIPT_GENERAL_CACHE_SIZE_SETTING.get(settings), SCRIPT_GENERAL_CACHE_EXPIRE_SETTING.get(settings),
596-
SCRIPT_GENERAL_MAX_COMPILATIONS_RATE_SETTING.get(settings), SCRIPT_GENERAL_MAX_COMPILATIONS_RATE_SETTING.getKey());
595+
ScriptCache.CompilationRate rate = SCRIPT_GENERAL_MAX_COMPILATIONS_RATE_SETTING.get(settings);
596+
if (SCRIPT_DISABLE_MAX_COMPILATIONS_RATE_SETTING.get(settings) || compilationLimitsEnabled() == false) {
597+
rate = SCRIPT_COMPILATION_RATE_ZERO;
598+
}
599+
return new CacheHolder(SCRIPT_GENERAL_CACHE_SIZE_SETTING.get(settings), SCRIPT_GENERAL_CACHE_EXPIRE_SETTING.get(settings), rate,
600+
SCRIPT_GENERAL_MAX_COMPILATIONS_RATE_SETTING.getKey());
597601
}
598602

599603
CacheHolder contextCacheHolder(Settings settings) {

0 commit comments

Comments
 (0)