Skip to content

Commit

Permalink
fix: enable queue_delay scaling even when not subscribed to a topic (
Browse files Browse the repository at this point in the history
…#3058)

Fixes #3016


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the Apache 2.0 License.
  • Loading branch information
efekarakus authored Nov 22, 2021
1 parent 964702e commit f522c9d
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ AutoScalingPolicyECSServiceAverageMemoryUtilization:
ScaleOutCooldown: 60
TargetValue: {{.Autoscaling.Memory}}
{{- end}}
{{- if (and .Subscribe .Autoscaling.QueueDelay) }}
{{- if .Autoscaling.QueueDelay }}
BacklogPerTaskCalculatorLogGroup:
Type: AWS::Logs::LogGroup
Properties:
Expand Down Expand Up @@ -117,11 +117,13 @@ BacklogPerTaskCalculatorFunction:
Fn::Join:
- ','
- - !GetAtt EventsQueue.QueueName
{{- if .Subscribe }}
{{- range $topic := .Subscribe.Topics }}
{{- if $topic.Queue }}
- !GetAtt {{logicalIDSafe $topic.Service}}{{logicalIDSafe $topic.Name}}EventsQueue.QueueName
{{- end }}
{{- end }}
{{- end }}

BacklogPerTaskCalculatorRole:
Type: AWS::IAM::Role
Expand Down Expand Up @@ -161,11 +163,13 @@ BacklogPerTaskCalculatorRole:
- sqs:GetQueueUrl
Resource:
- !GetAtt EventsQueue.Arn
{{- if .Subscribe }}
{{- range $topic := .Subscribe.Topics}}
{{- if $topic.Queue}}
- !GetAtt {{logicalIDSafe $topic.Service}}{{logicalIDSafe $topic.Name}}EventsQueue.Arn
{{- end }}
{{- end }}
{{- end }}
ManagedPolicyArns:
- !Sub arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole

Expand Down Expand Up @@ -213,6 +217,7 @@ AutoScalingPolicyEventsQueue:
Unit: Count
TargetValue: {{$acceptableBacklog}}

{{- if .Subscribe }}
{{- range $topic := .Subscribe.Topics}}
{{- if $topic.Queue}}
AutoScalingPolicy{{logicalIDSafe $topic.Service}}{{logicalIDSafe $topic.Name}}EventsQueue:
Expand All @@ -235,7 +240,8 @@ AutoScalingPolicy{{logicalIDSafe $topic.Service}}{{logicalIDSafe $topic.Name}}Ev
Value: !GetAtt {{logicalIDSafe $topic.Service}}{{logicalIDSafe $topic.Name}}EventsQueue.QueueName
Unit: Count
TargetValue: {{$acceptableBacklog}}
{{- end }}{{/* range $topic := .Subscribe.Topics */}}
{{- end }}{{/* if $topic.Queue */}}
{{- end }}{{/* range $topic := .Subscribe.Topics */}}
{{- end }}{{/* if .Subscribe */}}

{{- end }}{{/* if (and .Subscribe .Autoscaling.QueueDelay) */}}
{{- end }}{{/* if .Autoscaling.QueueDelay */}}

0 comments on commit f522c9d

Please sign in to comment.