Critical email sync bug (#11885)
Removing the upsert to avoid the ON CONFLICT
This commit is contained in:
@ -62,19 +62,39 @@ export class MessagingMessageService {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (existingMessage) {
|
if (existingMessage) {
|
||||||
await messageChannelMessageAssociationRepository.upsert(
|
const existingAssociation =
|
||||||
{
|
await messageChannelMessageAssociationRepository.findOne(
|
||||||
messageChannelId,
|
{
|
||||||
messageId: existingMessage.id,
|
where: {
|
||||||
messageExternalId: message.externalId,
|
messageChannelId,
|
||||||
messageThreadExternalId: message.messageThreadExternalId,
|
messageId: existingMessage.id,
|
||||||
},
|
},
|
||||||
{
|
},
|
||||||
conflictPaths: ['messageChannelId', 'messageId'],
|
transactionManager,
|
||||||
indexPredicate: '"deletedAt" IS NULL',
|
);
|
||||||
},
|
|
||||||
transactionManager,
|
if (existingAssociation) {
|
||||||
);
|
await messageChannelMessageAssociationRepository.update(
|
||||||
|
{
|
||||||
|
id: existingAssociation.id,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
messageExternalId: message.externalId,
|
||||||
|
messageThreadExternalId: message.messageThreadExternalId,
|
||||||
|
},
|
||||||
|
transactionManager,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
await messageChannelMessageAssociationRepository.insert(
|
||||||
|
{
|
||||||
|
messageChannelId,
|
||||||
|
messageId: existingMessage.id,
|
||||||
|
messageExternalId: message.externalId,
|
||||||
|
messageThreadExternalId: message.messageThreadExternalId,
|
||||||
|
},
|
||||||
|
transactionManager,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user