At the moment FacebookClient class defines constant
DEFAULT_REQUEST_TIMEOUT = 60
and FacebookCurlHttpClient uses hardcoded value of 10 for CURLOPT_CONNECTTIMEOUT. These should be made configurable.
Why: we have hundred requests per second to our canvas page and there are times when FB is not responding which means for every request a new PHP process is created and then stuck for 60 seconds, which quickly exhaust our PHP pool and our web server becomes completely unavailable. That is why we feel it is important to have a possibility to configure these timeouts and make them appropriate for your server load.
Great idea! :)
@igor84 Same case here i wanted to open an issue for this but it's already opened, what you did in your case did you changed the timeout limits manually ?
For the moment, I created a new class that extends FacebookCurlHttpClient class and overrides openConnection method so we can set our own timeouts and then gave Facebook constructor this new class through http_client_handler config param.
Thank you for response, i may end up doing a similar solution for now too.
Thank you for reporting this issue and appreciate your patience. We've notified the core team for an update on this issue. We're looking for a response within the next 30 days or the issue may be closed.
Going to close this one since you can provide your own http client..
I wrote up a guide to customizing the HTTP client in the PHP SDK v5 and explain how to manipulate the timeouts. Hope that helps! :)
Hello from 2020.
For me it still happens that facebook is unable to answer in 30 seconds. Should I throw error for user to retry ? Or wait more ?
using https://graph.facebook.com me endpoint
Most helpful comment
I wrote up a guide to customizing the HTTP client in the PHP SDK v5 and explain how to manipulate the timeouts. Hope that helps! :)