Skip to content

fix: sync issue between db and es #817

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

Merged
merged 2 commits into from
Jun 5, 2025
Merged

fix: sync issue between db and es #817

merged 2 commits into from
Jun 5, 2025

Conversation

hentrymartin
Copy link
Collaborator

No description provided.

@@ -233,6 +233,15 @@ module.exports = [
transaction: t,
});

const invitesToBeUpdated = await models.ProjectMemberInvite.findAll({
Copy link

Choose a reason for hiding this comment

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

Consider adding error handling for the findAll operation to ensure that any issues during database retrieval are properly managed.

const invitesToBeUpdated = await models.ProjectMemberInvite.findAll({
where: {
applicationId: {
[Op.in]: copilotApplications.map(item => item.id),
Copy link

Choose a reason for hiding this comment

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

Ensure that copilotApplications is defined and contains valid data before using it in the query. This will prevent potential runtime errors if copilotApplications is undefined or empty.

@@ -245,6 +254,15 @@ module.exports = [
},
transaction: t,
});

invitesToBeUpdated.forEach((inviteToBeUpdated) => {
Copy link

Choose a reason for hiding this comment

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

Consider adding error handling for the forEach loop to ensure that any issues with sending resources to the Kafka bus do not cause the entire transaction to fail.


invitesToBeUpdated.forEach((inviteToBeUpdated) => {
req.log.info(inviteToBeUpdated.toJSON(), 'invite to be updated')
util.sendResourceToKafkaBus(
Copy link

Choose a reason for hiding this comment

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

Ensure that util.sendResourceToKafkaBus handles potential errors internally or consider wrapping it in a try-catch block to handle any exceptions that might occur during the operation.

@hentrymartin hentrymartin merged commit 595e046 into develop Jun 5, 2025
1 check passed
@hentrymartin hentrymartin deleted the pm-1169_2 branch June 5, 2025 00:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant