-
Notifications
You must be signed in to change notification settings - Fork 56
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
Conversation
@@ -233,6 +233,15 @@ module.exports = [ | |||
transaction: t, | |||
}); | |||
|
|||
const invitesToBeUpdated = await models.ProjectMemberInvite.findAll({ |
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.
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), |
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.
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) => { |
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.
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( |
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.
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.
No description provided.