Commit 7e61a3a3 authored by Pedro Duarte's avatar Pedro Duarte
Browse files

fix on the aggregation logic

parent 60a1c852
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -108,9 +108,10 @@ class GnmiSessionHandler:
            if len(updates) > 1:
            if len(updates) > 1:
                # Create a new notification with all updates for this resource type
                # Create a new notification with all updates for this resource type
                aggregated_notification = type(notifications[0])()
                aggregated_notification = type(notifications[0])()
                # Copy the first notification's structure
                aggregated_notification.CopyFrom(notifications[0])
                aggregated_notification.CopyFrom(notifications[0])
                # Clear the updates and add our aggregated ones
                # Clear the updates and add our aggregated ones
                aggregated_notification.update.Clear()
                del aggregated_notification.update[:]  # Clear the repeated field
                aggregated_notification.update.extend(updates)
                aggregated_notification.update.extend(updates)
                # Use the latest timestamp
                # Use the latest timestamp
                if hasattr(updates[0], 'timestamp') and updates[0].timestamp:
                if hasattr(updates[0], 'timestamp') and updates[0].timestamp: