Drop duplicate stories

This commit is contained in:
Josh Perez 2022-07-29 19:01:33 -04:00 committed by GitHub
parent c3bb3b152e
commit 3af478837d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 2 deletions

View File

@ -2074,7 +2074,7 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
// First, check for duplicates. If we find one, stop processing here. // First, check for duplicates. If we find one, stop processing here.
const inMemoryMessage = window.MessageController.findBySender( const inMemoryMessage = window.MessageController.findBySender(
this.getSenderIdentifier() this.getSenderIdentifier()
); )?.attributes;
if (inMemoryMessage) { if (inMemoryMessage) {
log.info( log.info(
`handleDataMessage/${idLog}: cache hit`, `handleDataMessage/${idLog}: cache hit`,
@ -2090,7 +2090,14 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
inMemoryMessage || (await getMessageBySender(this.attributes)); inMemoryMessage || (await getMessageBySender(this.attributes));
const isUpdate = Boolean(data && data.isRecipientUpdate); const isUpdate = Boolean(data && data.isRecipientUpdate);
if (existingMessage && type === 'incoming') { const isDuplicateMessage =
existingMessage &&
(type === 'incoming' ||
(type === 'story' &&
existingMessage.storyDistributionListId ===
this.attributes.storyDistributionListId));
if (isDuplicateMessage) {
log.warn( log.warn(
`handleDataMessage/${idLog}: Received duplicate message`, `handleDataMessage/${idLog}: Received duplicate message`,
this.idForLogging() this.idForLogging()

View File

@ -2616,6 +2616,10 @@ export default class MessageReceiver
return; return;
} }
log.info(
'MessageReceiver.handleSyncMessage: handling storyMessageRecipients isRecipientUpdate sync message',
getEnvelopeId(envelope)
);
const ev = new StoryRecipientUpdateEvent( const ev = new StoryRecipientUpdateEvent(
{ {
destinationUuid: envelope.destinationUuid.toString(), destinationUuid: envelope.destinationUuid.toString(),