Skip to content

Commit

Permalink
fix: prevent reboot (#512)
Browse files Browse the repository at this point in the history
  • Loading branch information
aleortega authored Dec 3, 2024
1 parent f1e9263 commit 2520f32
Showing 1 changed file with 31 additions and 11 deletions.
42 changes: 31 additions & 11 deletions src/adapters/deployer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,31 @@ export function createDeployerComponent(
servers: servers.join(',')
})

await downloadEntityAndContentFiles(
{ ...components, fetcher: components.fetch },
entity.entityId,
servers,
new Map(),
'content',
10,
1000
)
try {
await downloadEntityAndContentFiles(
{ ...components, fetcher: components.fetch },
entity.entityId,
servers,
new Map(),
'content',
10,
1000
)
} catch (error: any) {
logger.error('Failed to download entity', {
entityId: entity.entityId,
entityType: entity.entityType,
errorMessage: error.message
})

const match = error.message?.match(/status: 4\d{2}/)

if (match) {
await markAsDeployed()
}

return
}

logger.info('Entity stored', { entityId: entity.entityId, entityType: entity.entityType })

Expand All @@ -66,7 +82,9 @@ 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,
entityType: entity.entityType
})
}

Expand All @@ -90,7 +108,9 @@ 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,
entityType: entity.entityType
})
}
await markAsDeployed()
Expand Down

0 comments on commit 2520f32

Please sign in to comment.