Skip to content
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

fix(seatool deletes): When a record is deleted in seatool, it should be deleted from our system. #370

Merged
merged 2 commits into from
Feb 8, 2024

Conversation

mdial89f
Copy link
Contributor

@mdial89f mdial89f commented Feb 7, 2024

Purpose

This adds support for seatool delete events. When a record is deleted in seatool, it is deleted in our system and is no longer visible.

Linked Issues to Close

Closes https://qmacbis.atlassian.net/browse/OY2-27186

Approach

We had deferred the handling of seatool events until we had a better understanding of what was wanted.
This now adds support for seatool delete events.
On delete

  • a tombstone record is sent to kafka by the seatool-connectors appliance. This isn't new.
  • that tombstone is provided to our sinkSeatool function.
  • Now, instead of skipping tombstones, we take action
    • We create an object that has all seatool tracked properties
    • We set each property to undefined
    • We index that object to main
    • This has the effect of removing only the seatool data from that record, and makes the record no longer appear on our dashboard.

It appears that we had already tried to implement this logic, but a 'return' in the place where a 'continue' should be was causing the null record to not be sent to opensearch.

Difference between return and continue here:


Using return:
When a record with no value is encountered, it logs the delete event and then immediately exits the function. This is significant because it means that no further processing will occur for any remaining records within the same recordKey group or any other groups.
This early exit from the function could lead to incomplete processing of data if there are multiple records to be processed.

Using continue:
The continue keyword is used inside the first loop when a record with no value is encountered, indicating a delete event. This causes the loop to skip the current iteration and move on to the next iteration of the loop.
This means that after logging the delete event, the code will continue processing any remaining records within the same recordKey group.


Assorted Notes/Considerations/Learning

None

@mdial89f mdial89f self-assigned this Feb 7, 2024
@mdial89f mdial89f added type: FIX Submit bug fixes status: READY PR is ready for review labels Feb 7, 2024
@@ -52,7 +52,8 @@ export const seatool_main = async (event: KafkaEvent) => {
submissionDate: null,
subject: null,
};
return;
console.log(`SEATOOL DELETE EVENT: ${id}`);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i know this isn't really related, but i think we should have some way of ensuring that these list of fields are pulled from someone what ensures this inclues all the possible field for these records. cause at some point its gonna be forgotten. im not where where to get that list for.... but could be a good follow on ticket. thoughts?

Copy link
Collaborator

@benjaminpaige benjaminpaige left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes please continue. left one comment that may be a think work looking into down the road.

@mdial89f mdial89f merged commit 3406a9b into master Feb 8, 2024
22 checks passed
@mdial89f mdial89f deleted the seadelete branch February 10, 2024 04:24
Copy link
Contributor

🎉 This PR is included in version 1.7.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Copy link
Contributor

🎉 This PR is included in version 1.5.0-val.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released on @val released status: READY PR is ready for review type: FIX Submit bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants