fix(ai): prevent insufficient capacity payments #3035
Merged
+21
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Warning
Depends on livepeer/ai-worker#73 to be merged. Additionally the
mod.go
file should be updated to poitn to the right worker commit.What does this pull request do? Explain your changes. (required)
This commit enhances the Orchestrator's capacity handling by returningan error prior to processing payments when capacity is insufficient. This prevents that the Gateway overpays for requests.
Specific updates (required)
CheckAICapacity
was added to thecore/orchestrator.go
file.handleAIRequest
method was changed so that the O first checks whether it can process a request before processing a payment.How did you test each of these updates (required)
Does this pull request close any open issues?
https://linear.app/livepeer-ai-spe/issue/LIV-175/orchestrators-get-paid-for-unsuccessful-jobs
Checklist:
make
runs successfully./test.sh
pass