fix(ai): prevent insufficient capacity payments
[!WARNING] Depends on https://github.com/livepeer/ai-worker/pull/73 to be merged. Additionally the
mod.gofile 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)
- A new
CheckAICapacitywas added to thecore/orchestrator.gofile. - The AI
handleAIRequestmethod 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:
- [x] Read the contribution guide
- [x]
makeruns successfully - [ ] All tests in
./test.shpass - [x] README and other documentation updated
- [ ] Pending changelog updated
@yondonfu, I've reviewed the payment workflow and it appears to be functioning as expected. Could you quickly confirm if you see any issues with this fix?
@yondonfu, I've reviewed the payment workflow and it appears to be functioning as expected. Could you quickly confirm if you see any issues with this fix?
Looks reasonable!