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: selection algo filtering on max price fixed #3179

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ad-astra-video
Copy link
Collaborator

What does this pull request do? Explain your changes. (required)

Fixes behavior of gateway when no max price is set. 0 maxPrice will return to being no max price filter enabled.

The addition of maxPricePerCapability included initializing a zero max price by default so the map is fully initialized. This broke the filterByMaxPrice function that checked for an unset maxPrice of nil.
Specific updates (required)

  • updates filterByMaxPrice function in selection_algorithm.go to check for 0 rather than checking for nil
  • added test to cover this so will fail in future if behavior of max price filtering changes
  • updated TestFilter test to set a maxPrice of 0 if none set

How did you test each of these updates (required)

Added new test and ran all tests in selection_algorithm_test.go

Does this pull request close any open issues?

Checklist:

  • Read the contribution guide
  • make runs successfully
  • All tests in ./test.sh pass X selection_algorithm_test.go pass.
  • README and other documentation updated
  • Pending changelog updated

@github-actions github-actions bot added the AI Issues and PR related to the AI-video branch. label Sep 21, 2024
Copy link
Member

@victorges victorges left a comment

Choose a reason for hiding this comment

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

lgtm

server/selection_algorithm.go Outdated Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

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

thanks for adding tests 🙏

@ad-astra-video
Copy link
Collaborator Author

I updated for suggested change. Learned something new, did not know Sign() did that!

@leszko leszko deleted the branch livepeer:master November 7, 2024 08:26
@leszko leszko closed this Nov 7, 2024
@rickstaa rickstaa reopened this Nov 13, 2024
@rickstaa rickstaa changed the base branch from ai-video to master November 13, 2024 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AI Issues and PR related to the AI-video branch.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants