-
Notifications
You must be signed in to change notification settings - Fork 3.1k
fix(#4858): deduplicate events #4872
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| ]); | ||
| const incomingEvent = new InstanceEvent(message.data); | ||
| if (this.seenEventKeys.has(incomingEvent.key)) { | ||
| return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this may be wrong here because then listOffset doesn't get updated properly.
@SteKoe @ulischulte your thoughts on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, but as far as I can see, the offset is not used in the view anyway. I will dig into that and check if it is still needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SteKoe any updates on this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
listOffset is now respected and adjusted.
| export function deduplicateInstanceEvents(events: InstanceEvent[]) { | ||
| const seen = new Set<string>(); | ||
| return events.filter((event) => { | ||
| if (seen.has(event.key)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SteKoe is the event key really enough?
It's imperative, in my opinion, that a SBA instance X shows the events recorded by the same instance and not, for example, by the instance Y.
Otherwise there is no traceability anymore and it's, therefore, better to keep things as they're now by enduring the duplicates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the backend does not contain the instance name of SBA in the events, this would be a bigger change than just adding deduplication in frontend.
As key is just using instanceId and version, no. We have to respect any value here. Event type as well as timestamp. Otherwise the following events would be reduced, even though they are not the same:
const events = [
{instance: '123', version: 1, type: "REGISTERED", timestamp: "678"},
{instance: '123', version: 1, type: "DEREGISTERED", timestamp: "890"},
]Thanks to the existing tests, I was able to extend the behavior and added some more use cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But then you won't dedup anything I think
No description provided.