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

Fix regression brought by using time.NewTimer() in scale loop #1739

Merged
merged 2 commits into from
Apr 16, 2021

Conversation

zroubalik
Copy link
Member

@zroubalik zroubalik commented Apr 14, 2021

Signed-off-by: Zbynek Roubalik zroubali@redhat.com

#1704 changed the way how is the timer in scale loop calculated, but we have missed a bug. The timer was initialized only once (at the start), causing the scale loop not perform any checks :)

Checklist

  • Commits are signed with Developer Certificate of Origin (DCO - learn more)
  • Changelog has been updated

Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>
Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>
Copy link
Contributor

@arschles arschles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is totally my fault @zroubalik - sorry about it! the fix looks good.

for {
tmr := time.NewTimer(pollingInterval)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zroubalik this is a subtle fix (yet obviously important!) - is it possible somehow to add a test for it? the only apparent way to me would be to pull the timer-related code out into a utility function and then test that. thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(and if so, I can pick that up in a follow-up PR)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am concerned that pulling that part of code to the utility function would make the code less readable and complex. WDYT?
Anyway more tests are always good, so if you come up with some good way how to test this stuff, I wouldn't be mad :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ha, that was my idea to make it more testable. I don't have others at the moment, but I'll keep my mind open 👍

@zroubalik zroubalik merged commit 6df54f3 into kedacore:main Apr 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants