Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure that all scalers are closed #1416

Merged
merged 2 commits into from
Dec 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
- Add metricName field to postgres scaler and auto generate if not defined. ([PR #1381](https://github.com/kedacore/keda/pull/1381))
- Mask password in postgres scaler auto generated metricName. ([PR #1381](https://github.com/kedacore/keda/pull/1381))
- Bug fix for pending jobs in ScaledJob's accurateScalingStrategy . ([#1323](https://github.com/kedacore/keda/issues/1323))
- Fix memory leak because of unclosed scalers. ([#1413](https://github.com/kedacore/keda/issues/1413))

### Breaking Changes

Expand Down
3 changes: 2 additions & 1 deletion pkg/scaling/scale_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ func (h *scaleHandler) checkScalers(ctx context.Context, scalableObject interfac

func (h *scaleHandler) checkScaledObjectScalers(ctx context.Context, scalers []scalers.Scaler) bool {
isActive := false
for _, scaler := range scalers {
for i, scaler := range scalers {
isTriggerActive, err := scaler.IsActive(ctx)
scaler.Close()

Expand All @@ -214,6 +214,7 @@ func (h *scaleHandler) checkScaledObjectScalers(ctx context.Context, scalers []s
if scaler.GetMetricSpecForScaling()[0].Resource != nil {
h.logger.V(1).Info("Scaler for scaledObject is active", "Metrics Name", scaler.GetMetricSpecForScaling()[0].Resource.Name)
}
closeScalers(scalers[i+1:])
break
}
}
Expand Down