From 4444fc131581e983495bb9af9a8810eb148eb45b Mon Sep 17 00:00:00 2001 From: NovaOSS Admins Date: Mon, 16 Oct 2023 10:37:33 +0000 Subject: [PATCH] Fixed API returning error if no provider available --- README.md | 8 ++++++++ api/responder.py | 9 +++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index e7c6a04..48dc42b 100644 --- a/README.md +++ b/README.md @@ -329,7 +329,15 @@ It is recommended to use the default ports, because this will make it easier to Make sure you have read all the according sections and have set up everything correctly. +## Autorewards + +```bash +0 0 * * * cd /home/nova-api && python rewards +crontab -e +``` + ## Donations + When someone donates, manually update the credits and role to "helper" in the database. For enterprise donations with more lax rate-limits, set the role to "enterprise". Make sure to also include the donation in the `donations` database! diff --git a/api/responder.py b/api/responder.py index 7b1f35e..ed5ee07 100644 --- a/api/responder.py +++ b/api/responder.py @@ -65,6 +65,7 @@ async def respond( } skipped_errors = { + 'no_provider_key': 0, 'insufficient_quota': 0, 'billing_not_active': 0, 'critical_provider_error': 0, @@ -95,12 +96,8 @@ async def respond( provider_key = provider_auth.split('>')[1] if provider_key == '--NO_KEY--': - print(f'No key for {provider_name}') - yield await errors.yield_error(500, - 'Sorry, our API seems to have issues connecting to our provider(s).', - 'This most likely isn\'t your fault. Please try again later.' - ) - return + skipped_errors['no_provider_key'] += 1 + continue target_request['headers'].update(target_request.get('headers', {}))