DefaultNotificationRuleProcessor - submit to notificationExecutor sooner not to block the caller
This commit is contained in:
parent
a6f1b7228c
commit
ee080538a4
@ -77,7 +77,7 @@ public class DefaultNotificationRuleProcessor implements NotificationRuleProcess
|
||||
public void process(NotificationRuleTrigger trigger) {
|
||||
NotificationRuleTriggerType triggerType = trigger.getType();
|
||||
TenantId tenantId = triggerType.isTenantLevel() ? trigger.getTenantId() : TenantId.SYS_TENANT_ID;
|
||||
|
||||
notificationExecutor.submit(() -> {
|
||||
try {
|
||||
List<NotificationRule> enabledRules = notificationRulesCache.getEnabled(tenantId, triggerType);
|
||||
if (enabledRules.isEmpty()) {
|
||||
@ -88,7 +88,6 @@ public class DefaultNotificationRuleProcessor implements NotificationRuleProcess
|
||||
enabledRules.removeIf(rule -> deduplicationService.alreadyProcessed(trigger, rule));
|
||||
}
|
||||
final List<NotificationRule> rules = enabledRules;
|
||||
notificationExecutor.submit(() -> {
|
||||
for (NotificationRule rule : rules) {
|
||||
try {
|
||||
processNotificationRule(rule, trigger);
|
||||
@ -96,10 +95,10 @@ public class DefaultNotificationRuleProcessor implements NotificationRuleProcess
|
||||
log.error("Failed to process notification rule {} for trigger type {} with trigger object {}", rule.getId(), rule.getTriggerType(), trigger, e);
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (Throwable e) {
|
||||
log.error("Failed to process notification rules for trigger: {}", trigger, e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void processNotificationRule(NotificationRule rule, NotificationRuleTrigger trigger) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user