Skip to content

Commit 7ae41b4

Browse files
authored
Merge pull request #3432 from artilleryio/fix/fargate-retries-launch-count
2 parents 4a6a5aa + 83cfac3 commit 7ae41b4

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

packages/artillery/lib/platform/aws-ecs/legacy/run-cluster.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1713,6 +1713,19 @@ async function ecsRunTask(context) {
17131713

17141714
try {
17151715
const runData = await ecs.runTask(params).promise();
1716+
1717+
const launchedTasksCount = runData.tasks?.length || 0;
1718+
tasksRemaining -= launchedTasksCount;
1719+
1720+
if (launchedTasksCount > 0) {
1721+
const newTaskArns = runData.tasks.map((task) => task.taskArn);
1722+
context.taskArns = context.taskArns.concat(newTaskArns);
1723+
artillery.globalEvents.emit('metadata', {
1724+
platformMetadata: { taskArns: newTaskArns }
1725+
});
1726+
debug(`Launched ${launchedTasksCount} tasks`);
1727+
}
1728+
17161729
if (runData.failures.length > 0) {
17171730
artillery.log('Some workers failed to start');
17181731
const uniqueReasons = [
@@ -1723,19 +1736,6 @@ async function ecsRunTask(context) {
17231736
await sleep(10 * 1000);
17241737
throw new Error('Not enough ECS capacity');
17251738
}
1726-
1727-
if (runData.tasks?.length > 0) {
1728-
const newTaskArns = runData.tasks.map((task) => task.taskArn);
1729-
context.taskArns = context.taskArns.concat(newTaskArns);
1730-
artillery.globalEvents.emit('metadata', {
1731-
platformMetadata: { taskArns: newTaskArns }
1732-
});
1733-
debug(`Launched ${launchCount} tasks`);
1734-
tasksRemaining -= launchCount;
1735-
await sleep(250);
1736-
} else {
1737-
retries++;
1738-
}
17391739
} catch (runErr) {
17401740
if (runErr.code === 'ThrottlingException') {
17411741
artillery.log('ThrottlingException returned from ECS, retrying');

0 commit comments

Comments
 (0)