-
Notifications
You must be signed in to change notification settings - Fork 809
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
Try to set longer timeouts for Register() in connect #7736
Conversation
e51d603
to
2c56fe0
Compare
class.jetpack.php
Outdated
/** | ||
* Sets a minimum request timeout, and returns the current timeout | ||
* | ||
* @since 5.3 |
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.
We'll need to update this to 5.4.
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.
I left some feedback. Besides that, this makes sense to me.
The bigger things that we should fix are the doc block and perhaps deprecating the old function somehow.
class.jetpack.php
Outdated
@@ -4776,11 +4776,25 @@ public static function delete_secrets( $action, $user_id ) { | |||
* @since 2.6 | |||
* @return int | |||
**/ | |||
public function get_remote_query_timeout_limit() { |
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.
Since we're effectively deleting and creating a new method here, we should probably update the @since
.
class.jetpack.php
Outdated
@@ -4776,11 +4776,25 @@ public static function delete_secrets( $action, $user_id ) { | |||
* @since 2.6 | |||
* @return int | |||
**/ | |||
public function get_remote_query_timeout_limit() { |
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.
Should we find a way to deprecate get_remote_query_timeout_limit()
to minimize errors if other plugins are using this?
class.jetpack.php
Outdated
$timeout = (int) ini_get( 'max_execution_time' ); | ||
if ( ! $timeout ) // Ensure exec time set in php.ini | ||
$timeout = 30; | ||
return intval( $timeout / 2 ); | ||
$timeout = 30; |
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.
Since we're touching this code, can we add the {
and }
around the if conditional?
class.jetpack.php
Outdated
$timeout = (int) ini_get( 'max_execution_time' ); | ||
if ( ! $timeout ) // Ensure exec time set in php.ini | ||
$timeout = 30; | ||
return intval( $timeout / 2 ); | ||
$timeout = 30; |
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.
Also, there are leading spaces before all lines except one in this method. That's a minor nitpick, but should be an easy fix if you go back in.
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.
This makes lots of sense to me, let's get this in. Thanks for a very constructive review, @ebinnion !
seems as though all of the feedback was addressed
* initial commit for running changelog * Update stable tag in readme * Changelog: move old releases to changelog.txt. Also add release post URL for 5.4 * Changelog: add #7729 * Changelog: add #7736 * Changelog: add #7737 * Changelog: add #7740 * Changelog: add #7742 * Changelog: add #7366 * Changelog: add #7664 * Changelog: add #7751 * Changelog: add #7764 * Changelog: add #7768 * Changelog: add #7796 * Changelog: add #7798 * Changelog: add #7822 * Changelog: add #7824 * Changelog: add #7825 * Changelog: add #7826 * Changelog: add #7829 * Changelog: add #7831 * Changelog: add #7837 * Changelog: add #7850 * Changelog: add #7852 * Changelog: add #6538 * Changelog: add #7767 * Changelog: add #7782 * Changelog: add #7797 * Changelog: add #7819 * update to-test to add misc stuff * add comment edit fix to changelog
* initial commit for running changelog * Update stable tag in readme * Changelog: move old releases to changelog.txt. Also add release post URL for 5.4 * Changelog: add #7729 * Changelog: add #7736 * Changelog: add #7737 * Changelog: add #7740 * Changelog: add #7742 * Changelog: add #7366 * Changelog: add #7664 * Changelog: add #7751 * Changelog: add #7764 * Changelog: add #7768 * Changelog: add #7796 * Changelog: add #7798 * Changelog: add #7822 * Changelog: add #7824 * Changelog: add #7825 * Changelog: add #7826 * Changelog: add #7829 * Changelog: add #7831 * Changelog: add #7837 * Changelog: add #7850 * Changelog: add #7852 * Changelog: add #6538 * Changelog: add #7767 * Changelog: add #7782 * Changelog: add #7797 * Changelog: add #7819 * update to-test to add misc stuff * add comment edit fix to changelog
When users connect Jetpack, the very first step is registration.
A couple of hundred sites a day fail registration because of timeouts, and of these the vast majority are sending us a timeout of 15 seconds or less (the timeout sent by Jetpack is 50% of the
max_execution_time
, to allow for multiple connection attempts).This is because in order to register the site, WPCOM must make a couple of requests, and some Jetpack sites are pretty slow.
Some sites appear to have execution timeouts as short as 10 seconds, which is not anywhere near enough to register a lot of the time.
This change tells PHP to increase the local
max_execution_time
for the duration of the register() step so that WPCOM has more time to register the site. If the request timeout is already longer than 60 seconds, it leaves it unaltered.To test: