Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional retry for transient errors. #14

Closed
bdiesenhaus opened this issue Mar 16, 2016 · 5 comments
Closed

Add optional retry for transient errors. #14

bdiesenhaus opened this issue Mar 16, 2016 · 5 comments

Comments

@bdiesenhaus
Copy link

I get a decent amount of transient errors while calling the Facebook api. Immediate retries of the same request work. It would be nice to add retry support into the sdk, possibly in APIRequest.callInternal(). The response has the is_transient field in it, if this is true it would be nice if the sdks retried instead of all calling clients to have to catch the APIException, check if it it is transient and then retry everywhere a request is made. Making this optional by adding a boolean (retry) with the number of retry attempts to the APIContext would allow for users to turn retries on or off.

Exception from sdks:
com.facebook.ads.sdk.APIException: {"error":{"message":"An unexpected error has occurred. Please retry your request later.","type":"OAuthException","is_transient":true,"code":2,"fbtrace_id":"DAbvR5wiN2d"}}

@bdiesenhaus
Copy link
Author

After looking into this further the check should be on the code 2 - API ServiceTemporary issue due to downtime - retry the operation after waiting not on the is_transient field.

@JiamingFB
Copy link
Contributor

Hi bdiesenhaus, in next version we'll provide interface to override sendGet, sendPost, and sendDelete in APIRequest, where you can easily customize and add auto-retry logic.

We don't have plan to add the retry in SDK, because it could be risky to silently retry requests, especially for POST, which could potentially create duplicated ads.

@bdiesenhaus
Copy link
Author

@JiamingFB , thanks any idea on timing of the next version?

@JiamingFB
Copy link
Contributor

The next SDK version will come with the next API version, which is expected to be in April.

@JiamingFB
Copy link
Contributor

New version was just released.
Please refer to the NetworkCustomisation example for handling retries for request failures. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants