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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ workflows:
context : org-global
filters:
branches:
only: ['develop', 'migration-setup', 'pm-1169_1']
only: ['develop', 'migration-setup']
- deployProd:
context : org-global
filters:
Expand Down
17 changes: 17 additions & 0 deletions src/routes/projectMemberInvites/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.

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.

}
},
transaction: t,
});

// Cancel the existing invites which are opened via
// applications
await models.ProjectMemberInvite.update({
Expand All @@ -245,6 +254,14 @@ 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.

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.

req,
EVENT.ROUTING_KEY.PROJECT_MEMBER_INVITE_UPDATED,
RESOURCES.PROJECT_MEMBER_INVITE,
inviteToBeUpdated.toJSON());
})
}

await t.commit();
Expand Down