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(Redis Streams): Allow default value of 0 for activationLagCount #6481

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

rickbrouwer
Copy link
Contributor

@rickbrouwer rickbrouwer commented Jan 12, 2025

This PR was created due to a bug found and reported as an issue #6478.

The documentation Redis Streams states that a default of 0 is allowed. In version v2.15.1 seems that be possible.
In v2.16 a check is applied with a refactoring where the value 0 is not allowed:

if r.ActivationLagCount == 0 {
	err := errors.New("activationLagCount required for Redis lag")
	return err
}

The code contains the following line:

return []external_metrics.ExternalMetricValue{metric}, metricCount > s.metadata.ActivationLagCount, nil

The second return value (the boolean) determines whether the scaler is active. This becomes true if metricCount > ActivationLagCount.
Because ActivationLagCount cannot be 0, this means that there must be at least 2 messages before scaling is activated. This means that scaling can never be activated on 1 message.

Checklist

Fixes #6478

@rickbrouwer rickbrouwer requested a review from a team as a code owner January 12, 2025 19:19
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.

Redis Streams Scaler Does Not Trigger on a Single Message
1 participant