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:
@@ -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
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user