Skip to content

Commit 5384e81

Browse files
inhumantsartrivikr
andauthored
Apply suggestions from code review
Co-authored-by: Trivikram Kamat <[email protected]>
1 parent 23acd87 commit 5384e81

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

index.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ async function runTask(ecs, clusterName, taskDefArn, waitForMinutes) {
4949
},
5050
launchType: launchType,
5151
networkConfiguration: awsvpcConfiguration === {} ? {} : { awsvpcConfiguration: awsvpcConfiguration }
52-
}).promise();
52+
});
5353

5454
core.debug(`Run task response ${JSON.stringify(runTaskResponse)}`)
5555

@@ -79,14 +79,14 @@ async function waitForTasksStopped(ecs, clusterName, taskArns, waitForMinutes) {
7979

8080
core.info(`Waiting for tasks to stop. Will wait for ${waitForMinutes} minutes`);
8181

82-
const waitTaskResponse = await ecs.waitFor('tasksStopped', {
82+
const waitTaskResponse = await waitUntilTasksStopped({
83+
client: ecs,
84+
minDelay: WAIT_DEFAULT_DELAY_SEC,
85+
maxWaitTime: waitForMinutes * 60,
86+
}, {
8387
cluster: clusterName,
8488
tasks: taskArns,
85-
$waiter: {
86-
delay: WAIT_DEFAULT_DELAY_SEC,
87-
maxAttempts: (waitForMinutes * 60) / WAIT_DEFAULT_DELAY_SEC
88-
}
89-
}).promise();
89+
});
9090

9191
core.debug(`Run task response ${JSON.stringify(waitTaskResponse)}`);
9292
core.info('All tasks have stopped.');
@@ -97,7 +97,7 @@ async function tasksExitCode(ecs, clusterName, taskArns) {
9797
const describeResponse = await ecs.describeTasks({
9898
cluster: clusterName,
9999
tasks: taskArns
100-
}).promise();
100+
});
101101

102102
const containers = [].concat(...describeResponse.tasks.map(task => task.containers))
103103
const exitCodes = containers.map(container => container.exitCode)

0 commit comments

Comments
 (0)