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 4 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 🙏

Co-authored-by: Victor Elias <victorgelias@gmail.com>
@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
Copy link

codecov bot commented Jan 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 33.72602%. Comparing base (1a4c7c7) to head (ca0ac3b).

Additional details and impacted files

Impacted file tree graph

@@                 Coverage Diff                 @@
##              master       #3179         +/-   ##
===================================================
+ Coverage   33.72335%   33.72602%   +0.00267%     
===================================================
  Files            141         141                 
  Lines          37434       37434                 
===================================================
+ Hits           12624       12625          +1     
+ Misses         24089       24088          -1     
  Partials         721         721                 
Files with missing lines Coverage Δ
server/selection_algorithm.go 90.58824% <100.00000%> (ø)

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1a4c7c7...ca0ac3b. Read the comment docs.

Files with missing lines Coverage Δ
server/selection_algorithm.go 90.58824% <100.00000%> (ø)

... and 1 file with indirect coverage changes

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