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

PWX-35601 Add length check before accessing in round robin #2399

Merged
merged 2 commits into from
Jan 11, 2024

Conversation

dahuang-purestorage
Copy link
Contributor

What this PR does / why we need it:
This PR adds a few check before accessing the filteredNodes:

  1. If the length is zero, we return empty string and false (isRemote)
  2. Before accessing the array, we take a reminder of the currentIndex with the length of the array.

Which issue(s) this PR fixes (optional)
PWX-35601

Testing Notes
Added simple UT to check the function

Copy link
Contributor

@nrevanna nrevanna left a comment

Choose a reason for hiding this comment

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

LGTM. Have a nit comment though.

@dahuang-purestorage dahuang-purestorage merged commit 7d0e1f9 into master Jan 11, 2024
dahuang-purestorage added a commit that referenced this pull request Jan 11, 2024
* Add length check before accessing in round robin

This PR adds a few check before accessing the filteredNodes:
1. If the length is zero, we return empty string and false (isRemote)
2. Before accessing the array, we take a reminder of the currentIndex with the length of the array.

JIRA: PWX-35601

Signed-off-by: dahuang <[email protected]>
dahuang-purestorage added a commit that referenced this pull request Jan 11, 2024
…2400)

* Add length check before accessing in round robin

This PR adds a few check before accessing the filteredNodes:
1. If the length is zero, we return empty string and false (isRemote)
2. Before accessing the array, we take a reminder of the currentIndex with the length of the array.

JIRA: PWX-35601

Signed-off-by: dahuang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants