Skip to content

Apache Lucene open-source search software

SOLR-10643: Unset hasPendingActions flag after all actions have been run

Shalin Shekhar Mangar607184c47ede
diff --git a/solr/core/src/java/org/apache/solr/cloud/autoscaling/ScheduledTriggers.java b/solr/core/src/java/org/apache/solr/cloud/autoscaling/ScheduledTriggers.java
index 05b06ced3f0..8dfbddf9910 100644
--- a/solr/core/src/java/org/apache/solr/cloud/autoscaling/ScheduledTriggers.java
+++ b/solr/core/src/java/org/apache/solr/cloud/autoscaling/ScheduledTriggers.java
@@ -120,18 +120,20 @@ public class ScheduledTriggers implements Closeable {
if (actions != null) {
actionExecutor.submit(() -> {
assert hasPendingActions.get();
- // let the action executor thread wait instead of the trigger thread so we use the throttle here
- actionThrottle.minimumWaitBetweenActions();
- actionThrottle.markAttemptingAction();
- for (TriggerAction action : actions) {
- try {
- action.process(event);
- } catch (Exception e) {
- log.error("Error executing action: " + action.getName() + " for trigger event: " + event, e);
- throw e;
- } finally {
- hasPendingActions.set(false);
+ try {
+ // let the action executor thread wait instead of the trigger thread so we use the throttle here
+ actionThrottle.minimumWaitBetweenActions();
+ actionThrottle.markAttemptingAction();
+ for (TriggerAction action : actions) {
+ try {
+ action.process(event);
+ } catch (Exception e) {
+ log.error("Error executing action: " + action.getName() + " for trigger event: " + event, e);
+ throw e;
+ }
}
+ } finally {
+ hasPendingActions.set(false);
}
});
}