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
Do not lower the max_execution_time if it is already set to 0 (unlimited) #755
Conversation
@vedanshujain Can you please review and get this patch merged |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Sorry for delayed review).
LGTM! Given that we are touching this method, might as well add also add return statements to both this and in WC's method so that callee can check whether the op was successful or not.
Hi @vedanshujain!
The more I think about it, and experiment with a few possibilities locally, the less sure I am how valuable a return value would be.
Last but not least, even if a call to Given these things ... wdyt? |
@barryhughes I would suggest you always call in terms of the return value there really isn't anything other than the result of the |
Hmm, ok, let' leave as it is then for the time being. |
Our
ActionScheduler_Compatibility::raise_time_limit()
is designed so that it (theoretically), "Only allows raising the existing limit and prevents lowering it."However, in cases where the max time is already 0 (zero means unlimited) and a value such as 30 is passed to this method, the
max_execution_time
will indeed be changed to 30, effectively lowering it. This change addresses that.Testing
Testing this is a little awkward, but I'd suggest using the WP CLI shell (
wp shell
) and running through permutations similar to those you see in the related tests, for example:Things you can try with this approach:
max_execution_time
is zero (unlimited), subsequent calls to this method do not change it.max_execution_time
is a non-zero positive int (such as 30), calls to this method where a lower non-zero value (such as 20) are passed do not change it.max_execution_time
is a non-zero positive int (such as 30), calls to this method where zero or a higher value (such as 60) are passed do change it appropriately.If you decide to test this way, remember you will need to restart
wp shell
when you change branch.Closes #754 and #745.