Skip to content

Commit

Permalink
Merge pull request #107 from depot/update-service
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobwgillespie authored Sep 9, 2024
2 parents d20515c + f3b4581 commit 55f95be
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/handlers/updater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,6 @@ async function checkForUpdates() {

const newerThan = parseISO(req.newerThan)

try {
await ecs.send(new UpdateServiceCommand({cluster, service: serviceName, forceNewDeployment: true}))
} catch (err) {
console.error('Error updating service, ignoring', err)
}

const {taskArns} = await ecs.send(new ListTasksCommand({cluster, serviceName}))
if (!taskArns || taskArns.length === 0) return
const {tasks} = await ecs.send(new DescribeTasksCommand({cluster, tasks: taskArns}))
Expand All @@ -55,6 +49,12 @@ async function checkForUpdates() {
if (desiredStatus !== 'RUNNING') continue
console.log('Found old task to upgrade', task.taskArn)
await ecs.send(new StopTaskCommand({cluster, task: task.taskArn, reason: 'Upgrading'}))

try {
await ecs.send(new UpdateServiceCommand({cluster, service: serviceName, forceNewDeployment: true}))
} catch (err) {
console.error('Error updating service, ignoring', err)
}
}
}

Expand Down

0 comments on commit 55f95be

Please sign in to comment.