Rate limit handling (#11)

* Added a rate limit exception
* Reduce request/response timeouts because looks like there are major issues
* Add rate limit exception catch to all consumers
* Version to 0.6.3
This commit is contained in:
cybermaggedon 2024-08-19 22:15:32 +01:00 committed by GitHub
parent 25f557d8a5
commit a38f530c5f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 188 additions and 152 deletions

View file

@ -26,6 +26,7 @@ from .... schema import text_completion_request_queue
from .... schema import text_completion_response_queue
from .... log_level import LogLevel
from .... base import ConsumerProducer
from .... exceptions import TooManyRequests
module = ".".join(__name__.split(".")[1:-1])
@ -139,9 +140,8 @@ class Processor(ConsumerProducer):
except google.api_core.exceptions.ResourceExhausted:
print("429, resource busy, sleeping", flush=True)
time.sleep(15)
self.consumer.negative_acknowledge(msg)
# 429 / rate limits case
raise TooManyRequests
# Let other exceptions fall through