SIENTIAPDE-1174

feat: enhance notification filtering in Formatters and SlotManager classes

- Added logic to remove receiver groups with no notifications, improving the efficiency of notification handling.
- Implemented early return in Alerts and Reports workflows when there are no notifications or receiver groups, streamlining the processing flow.
This commit is contained in:
vitor-aignosi
2025-08-01 12:41:40 -03:00
parent ae0fa2fc8a
commit 6c1b7c4bf7
4 changed files with 20 additions and 0 deletions

View File

@@ -574,4 +574,11 @@ class Formatters(BaseActivity):
notification)
already_added_keys.append(key)
# Remove groups with no notifications
receiver_groups = {
group_name: group
for group_name, group in receiver_groups.items()
if group['notifications']
}
return receiver_groups

View File

@@ -318,6 +318,13 @@ class SlotManager(Redis):
notification)
already_added_keys.append(key)
# Remove groups with no notifications
receiver_groups = {
group_name: group
for group_name, group in receiver_groups.items()
if group['notifications']
}
return receiver_groups
@activity.defn(name="store_notification_cache")

View File

@@ -82,6 +82,9 @@ class Alerts:
}
)
if not log_report:
return
# Store the notification_id sendings to avoid sending them again
await workflow.execute_activity_method(
Activities.store_notification_cache,

View File

@@ -65,6 +65,9 @@ class Reports:
retry_policy=retry_policy
)
if not receiver_groups:
return
# Call subworkflow "process_notifications" passing the notification package
await workflow.execute_child_workflow(
'process_notifications',