From 71dde4348e2c9df230a89643b5b42a97034798fe Mon Sep 17 00:00:00 2001 From: Alejo Thomas Ortega Date: Mon, 28 Oct 2024 18:54:47 -0300 Subject: [PATCH 1/2] chore: add logs while discarding a deployment --- src/adapters/deployer/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/adapters/deployer/index.ts b/src/adapters/deployer/index.ts index e4337fa..75c762b 100644 --- a/src/adapters/deployer/index.ts +++ b/src/adapters/deployer/index.ts @@ -26,6 +26,7 @@ export function createDeployerComponent( const isSnsEventToSend = !!components.sns.eventArn if (exists || !(isSnsEntityToSend && isSnsEventToSend)) { + logger.info('Entity already stored', { entityId: entity.entityId, entityType: entity.entityType }) return await markAsDeployed() } From e9653b67a24fbb40b089e30e1a1a3e9db0b67506 Mon Sep 17 00:00:00 2001 From: Alejo Thomas Ortega Date: Mon, 28 Oct 2024 19:11:42 -0300 Subject: [PATCH 2/2] fix: forward of events with unchanged content --- src/adapters/deployer/index.ts | 45 +++++++++++++++++----------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/src/adapters/deployer/index.ts b/src/adapters/deployer/index.ts index 75c762b..bd24a69 100644 --- a/src/adapters/deployer/index.ts +++ b/src/adapters/deployer/index.ts @@ -25,31 +25,28 @@ export function createDeployerComponent( const isSnsEventToSend = !!components.sns.eventArn - if (exists || !(isSnsEntityToSend && isSnsEventToSend)) { - logger.info('Entity already stored', { entityId: entity.entityId, entityType: entity.entityType }) - return await markAsDeployed() - } - await components.downloadQueue.onSizeLessThan(1000) void components.downloadQueue.scheduleJob(async () => { - logger.info('Downloading entity', { - entityId: entity.entityId, - entityType: entity.entityType, - servers: servers.join(',') - }) + if (!exists) { + logger.info('Downloading entity', { + entityId: entity.entityId, + entityType: entity.entityType, + servers: servers.join(',') + }) - await downloadEntityAndContentFiles( - { ...components, fetcher: components.fetch }, - entity.entityId, - servers, - new Map(), - 'content', - 10, - 1000 - ) + await downloadEntityAndContentFiles( + { ...components, fetcher: components.fetch }, + entity.entityId, + servers, + new Map(), + 'content', + 10, + 1000 + ) - logger.info('Entity stored', { entityId: entity.entityId, entityType: entity.entityType }) + logger.info('Entity stored', { entityId: entity.entityId, entityType: entity.entityType }) + } const deploymentToSqs: DeploymentToSqs = { entity, @@ -57,7 +54,7 @@ export function createDeployerComponent( } // send sns - if (isSnsEntityToSend) { + if (isSnsEntityToSend && !exists) { const receipt = await client.send( new PublishCommand({ TopicArn: components.sns.arn, @@ -66,7 +63,8 @@ export function createDeployerComponent( ) logger.info('Notification sent', { messageId: receipt.MessageId as any, - sequenceNumber: receipt.SequenceNumber as any + sequenceNumber: receipt.SequenceNumber as any, + entityId: entity.entityId }) } @@ -79,7 +77,8 @@ export function createDeployerComponent( ) logger.info('Notification sent to events SNS', { MessageId: receipt.MessageId as any, - SequenceNumber: receipt.SequenceNumber as any + SequenceNumber: receipt.SequenceNumber as any, + entityId: entity.entityId }) } await markAsDeployed()