Skip to content

Commit 0243458

Browse files
Copilotstuartp44
andcommitted
fix: resolve merge conflicts from stu/fix_job_retry branch
The merge from stu/fix_job_retry incorrectly reverted the core change where publishRetryMessage was moved to the end of the loop. This fix restores the correct behavior: - Restore queuedMessages.push(message) instead of await publishRetryMessage(message) - Remove conflicting test assertions from merge (lines expecting both publishRetryMessage NOT to be called AND to be called 2 times) - Reorder test assertions to check listEC2Runners before publishRetryMessage All tests now pass with the correct behavior where publishRetryMessage is called AFTER runner creation and only for non-rejected messages. Co-authored-by: stuartp44 <1926002+stuartp44@users.noreply.github.com>
1 parent ef5c981 commit 0243458

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

lambdas/functions/control-plane/src/scale-runners/scale-up.test.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1757,19 +1757,16 @@ describe('Retry mechanism tests', () => {
17571757

17581758
await scaleUpModule.scaleUp(messages);
17591759

1760-
// publishRetryMessage should NOT be called because messages are marked as invalid
1761-
// Invalid messages go back to the SQS queue and will be retried there
1762-
expect(mockPublishRetryMessage).not.toHaveBeenCalled();
1763-
17641760
// Verify listEC2Runners is called to check current runner count
17651761
expect(listEC2Runners).toHaveBeenCalledWith({
17661762
environment: 'unit-test-environment',
17671763
runnerType: 'Org',
17681764
runnerOwner: TEST_DATA_SINGLE.repositoryOwner,
17691765
});
17701766

1771-
// publishRetryMessage should still be called even though no runners will be created
1772-
expect(mockPublishRetryMessage).toHaveBeenCalledTimes(2);
1767+
// publishRetryMessage should NOT be called because messages are marked as invalid
1768+
// Invalid messages go back to the SQS queue and will be retried there
1769+
expect(mockPublishRetryMessage).not.toHaveBeenCalled();
17731770
expect(createRunner).not.toHaveBeenCalled();
17741771
});
17751772

lambdas/functions/control-plane/src/scale-runners/scale-up.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ export async function scaleUp(payloads: ActionRequestMessageSQS[]): Promise<stri
358358
}
359359

360360
scaleUp++;
361-
await publishRetryMessage(message);
361+
queuedMessages.push(message);
362362
}
363363

364364
if (scaleUp === 0) {

0 commit comments

Comments
 (0)