Box java sdk - too many requests
AnsweredHi,
I'm using box java sdk to integrate my application to BOX. I want to know how 429 error responses from BOX server are being handled by box java sdk. Whether it retries the request after time specified in the Retry-After header or not?
And another thing whatever value we are in Retry-After header will in seconds or milliseconds?
Any help would be appreciated.
Thanks in advance.
-
Hey ,
The Java SDK does retry for cases of 5XX and 429. How we attempt retry is with exponential backoff with randomized jitter to negate too many requests firing off again at once with the retry.
You can see the logic for this backoff here.
The reason for using this type of backoff strategy is to make sure that the multitude of requests that could potentially be sent gets smoothed over a period of time on the retry and not too many of the requests are being sent over concurrently again.
The retry time is usually denoted in milliseconds.
Let us know if this is helpful and if you have any other questions please reach out. And for SDK specific issues please feel free to file a request here.
-
Hi Bharath N V,
You can set the setMaxRequestAttempts and setConnectTimeout on the BoxAPIConnection to get better results.
Example:
BoxAPIConnection api;
api = BoxDeveloperEditionAPIConnection.getAppEnterpriseConnection(boxConfig);
api.setMaxRequestAttempts(20); // number of attempts
api.setConnectTimeout(10000); // time out in millisecondsI have the same issue.
Regards,
Marcel
Please sign in to leave a comment.
Comments
4 comments