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

This commit is contained in:
Shalin Shekhar Mangar 2017-05-15 18:59:52 +05:30
parent 1f3f50745a
commit 607184c47e
1 changed files with 13 additions and 11 deletions

View File

@ -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);
}
});
}