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

Rate Limiting on the Facebook Graph API #148

Open
andre-st opened this issue Oct 17, 2018 · 0 comments
Open

Rate Limiting on the Facebook Graph API #148

andre-st opened this issue Oct 17, 2018 · 0 comments

Comments

@andre-st
Copy link

andre-st commented Oct 17, 2018

Problem: Facebook allows max. 200 requests/hour from a single user (server in the Shariff case).
If the limit is exceeded, FB starts annoying the admin with regular error notifications in his Facebook account.

Possible solution:
The Facebook ServiceInterface implementation in shariff-backend-php should watch the X-App-Usage HTTP response header and dynamically balance the call volume:

All responses to calls made to the Graph API include an X-App-Usage HTTP header. This header contains the current percentage of usage for your app.
(https://developers.facebook.com/docs/graph-api/advanced/rate-limiting)

The ServiceInterface could define a canRequest($url) method (for getRequest($url)), with the backend returning the cached value if canRequest is false. Most ServiceInterface implementations would just return true. Or getRequest() could check the limit, return false or null and trigger the cache. Whatever works for you.

The Facebook implementation, however, would return a value with respect to the rate limiting header and thus dynamically balances the call volume. This would be a neat feature.

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

No branches or pull requests

2 participants