Skip to content

Commit

Permalink
fix: prevent service to restart when it fails to download entity text…
Browse files Browse the repository at this point in the history
…ures
  • Loading branch information
aleortega committed Dec 3, 2024
1 parent 2cb753b commit be28815
Showing 1 changed file with 25 additions and 9 deletions.
34 changes: 25 additions & 9 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 Down

0 comments on commit be28815

Please sign in to comment.