Skip to content

Commit

Permalink
trim trailing newline from instance id
Browse files Browse the repository at this point in the history
Co-authored-by: Zeke Hunter-Green <zeke.huntergreen@guardian.co.uk>
  • Loading branch information
marjisound and zekehuntergreen committed Apr 3, 2024
1 parent 72a46e9 commit 2eb902a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/worker/src/asg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const updateScaleInProtection = async (
logger.info(`instanceId retrieved from worker instance: ${instanceId}`);

const input = {
InstanceIds: [instanceId.trim()],
InstanceIds: [instanceId],
AutoScalingGroupName: `transcription-service-workers-${stage}`,
ProtectedFromScaleIn: value,
};
Expand All @@ -40,7 +40,7 @@ export const getInstanceLifecycleState = async (
try {
if (stage !== 'DEV') {
const input = {
InstanceIds: [instanceId.trim()],
InstanceIds: [instanceId],
};
const command = new DescribeAutoScalingInstancesCommand(input);
const result = await autoScalingClient.send(command);
Expand Down
5 changes: 4 additions & 1 deletion packages/worker/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ export const getCurrentReceiptHandle = () => CURRENT_MESSAGE_RECEIPT_HANDLE;

const main = async () => {
const config = await getConfig();
const instanceId = readFile('/var/lib/cloud/data/instance-id');
const instanceId =
config.app.stage === 'DEV'
? ''
: readFile('/var/lib/cloud/data/instance-id').trim();

const metrics = new MetricsService(
config.app.stage,
Expand Down

0 comments on commit 2eb902a

Please sign in to comment.