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

BatchSliceOfStrings(): panic if count <= 0 #66

Merged
merged 1 commit into from
Sep 2, 2024
Merged

Conversation

Al2Klimov
Copy link
Member

Otherwise, 0 would lead to infinite empty slices.
Negative numbers already crash the program.

Otherwise, 0 would lead to infinite empty slices.
Negative numbers already crash the program.
@cla-bot cla-bot bot added the cla/signed CLA is signed by all contributors of a PR label Aug 16, 2024
@Al2Klimov Al2Klimov mentioned this pull request Aug 16, 2024
Copy link
Member

@oxzi oxzi left a comment

Choose a reason for hiding this comment

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

As I have tested and documented over at #32 (comment), both a count of zero as well as a negative count only do harm.

@yhabteab
Copy link
Member

yhabteab commented Sep 2, 2024

Currently it is only used here:

batches := utils.BatchSliceOfStrings(ctx, fields, c.Options.HMGetCount)

and redis.Options.HMGetCount is not allowed to be zero or a negative number, so this should be fine.

if o.HMGetCount < 1 {
return errors.New("hmget_count must be at least 1")
}

@yhabteab yhabteab merged commit bd2bf65 into main Sep 2, 2024
2 checks passed
@yhabteab yhabteab deleted the BatchSliceOfStrings-0 branch September 2, 2024 14:30
@yhabteab yhabteab added this to the 0.4.0 milestone Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla/signed CLA is signed by all contributors of a PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants