Skip to content

Commit e002da3

Browse files
committed
Disable rate limiting
1 parent 9447929 commit e002da3

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/external/http/sender/RequestExecutorService.java

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -449,27 +449,23 @@ public synchronized TimeValue executeEnqueuedTask() {
449449
}
450450

451451
private TimeValue executeEnqueuedTaskInternal() {
452-
var timeBeforeAvailableToken = rateLimiter.timeToReserve(1);
453-
if (shouldExecuteImmediately(timeBeforeAvailableToken) == false) {
454-
return timeBeforeAvailableToken;
455-
}
456452

457453
var task = queue.poll();
458454

459455
// TODO Batching - in a situation where no new tasks are queued we'll want to execute any prepared tasks
460456
// So we'll need to check for null and call a helper method executePreparedTasks()
461457

462458
if (shouldExecuteTask(task) == false) {
463-
return NO_TASKS_AVAILABLE;
459+
logger.warn(
460+
"not executing task [{}] because it is null or has already completed",
461+
task == null ? "null" : task.getRequestManager().inferenceEntityId()
462+
);
463+
return TimeValue.ZERO;
464464
}
465465

466-
// We should never have to wait because we checked above
467-
var reserveRes = rateLimiter.reserve(1);
468-
assert shouldExecuteImmediately(reserveRes) : "Reserving request tokens required a sleep when it should not have";
469-
470466
task.getRequestManager()
471467
.execute(task.getInferenceInputs(), requestSender, task.getRequestCompletedFunction(), task.getListener());
472-
return EXECUTED_A_TASK;
468+
return TimeValue.ZERO;
473469
}
474470

475471
private static boolean shouldExecuteTask(RejectableTask task) {

0 commit comments

Comments
 (0)