Fly-Style commented on code in PR #19286:
URL: https://github.com/apache/druid/pull/19286#discussion_r3084466980
##########
indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/supervisor/autoscaler/LagBasedAutoScaler.java:
##########
@@ -83,23 +82,24 @@ public LagBasedAutoScaler(
}
@Override
- public void start()
+ public int computeTaskCountForScaleAction()
{
- Callable<Integer> scaleAction = () -> {
- LOCK.lock();
- int desiredTaskCount = -1;
- try {
- desiredTaskCount = computeDesiredTaskCount(new
ArrayList<>(lagMetricsQueue));
- }
- catch (Exception ex) {
- log.warn(ex, "Exception while computing desired task count for
supervisor[%s]", spec.getId());
- }
- finally {
- LOCK.unlock();
- }
- return desiredTaskCount;
- };
+ LOCK.lock();
Review Comment:
I wonder if we really need a lock here, since the `STORE` into shared memory
is eliminated and `lagMetricsQueue` is captured into list in the callsite.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]