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:
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.
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 theX-App-Usage
HTTP response header and dynamically balance the call volume:The
ServiceInterface
could define acanRequest($url)
method (forgetRequest($url)
), with the backend returning the cached value ifcanRequest
is false. MostServiceInterface
implementations would just returntrue
. OrgetRequest()
could check the limit, returnfalse
ornull
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.