Skip to content

Commit

Permalink
fix: forward of events with unchanged content
Browse files Browse the repository at this point in the history
  • Loading branch information
aleortega committed Oct 28, 2024
1 parent 71dde43 commit f7cbed7
Showing 1 changed file with 18 additions and 21 deletions.
39 changes: 18 additions & 21 deletions src/adapters/deployer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,39 +25,36 @@ 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,
contentServerUrls: servers
}

// send sns
if (isSnsEntityToSend) {
if (isSnsEntityToSend && !exists) {
const receipt = await client.send(
new PublishCommand({
TopicArn: components.sns.arn,
Expand Down

0 comments on commit f7cbed7

Please sign in to comment.