Implement a retry logic for 429 and 500 errors? #156
createreadupdate
started this conversation in
Ideas
Replies: 2 comments
-
You should implement the retry mechanism on your side: A simple example could be as follows: $tries = 5;
$sleep = 0;
do {
try {
sleep($sleep);
$response = $client::chat()->create($parameters);
} catch (Exception $e) {
if (--$tries === 0) {
throw $e;
}
$response = null;
$sleep++;
}
} while ($response === null); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Could be put into HttpTransporter with an additional public method like ->setMaxRetries and a default of 1 to have no effect on the library as it is.
Some increasing sleep between the retries would be good too.
What do you think?
Beta Was this translation helpful? Give feedback.
All reactions