Closed mosource21 closed 5 months ago
Mm never thought about this, i did the same as Tboothman did.
I never experienced any issues with the imdb GraphQL api calls but yes in theory there is indeed no timeout limit set. Thanks for pointing this out!
I will add your solution and set the timeout at the same what php standard does, 30 seconds? That will still be a save setting and will ensure it does not time out too soon, agree?
Mm never thought about this, i did the same as Tboothman did. I never experienced any issues with the imdb GraphQL api calls but yes in theory there is indeed no timeout limit set. Thanks for pointing this out!
Yes, same fix is needed on the tboothman version. I am glad I tracked this problem down as it has been plaguing me for a bit. I do not know what causes it at IMDB end but every so often the API call just doesn't do anything at IMDB end and having no timeout means the script can get stuck depending on your general PHP configuration.
I will add your solution and set the timeout at the same what php standard does, 30 seconds? That will still be a save setting and will ensure it does not time out too soon, agree?
You can set it to 1 or 2 and it usually works fine but that is way to low for the default.
Yes I agree, I think you can easily make an argument that using the same value as the default PHP script timeout setting makes sense - 30 seconds https://www.php.net/manual/en/function.set-time-limit.php
Many thanks
Fixed in latest commit, thanks again!
Problem If there is a local ISP issue or a connection issue at IMDB that causes the Request.php to hang depending on your PHP configuration it can cause the script to hang indefinitely or wait a long period of time before continuing.
Solution The default Curl configuration does not set any timeout values so Curl will continue to run waiting for a response/data until if and when the script times out. If the script is run on the command line the default is to never timeout so the script will hang if they are any problems with IMDB and never return to the command line.
Add the following to Request.php around line 37
This sets a 10 second timeout.
From limited testing a 1-2 second timeout is usually plenty so 10 seconds should provide some leeway.
You may want to play it safe with a higher value (for example 30 - the default PHP timeout of a script) but the main thing is something is specified to stop the script from running forever (or potentially many minutes depending on global PHP timeout configuration).