Skip to content
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

chore: add logs while discarding a deployment #507

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions src/adapters/deployer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,38 +25,36 @@ export function createDeployerComponent(

const isSnsEventToSend = !!components.sns.eventArn

if (exists || !(isSnsEntityToSend && isSnsEventToSend)) {
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 All @@ -65,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
})
}

Expand All @@ -78,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()
Expand Down
Loading