mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-06-06 13:25:13 +02:00
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:
parent
25f557d8a5
commit
a38f530c5f
25 changed files with 188 additions and 152 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue