-
Notifications
You must be signed in to change notification settings - Fork 805
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
Connection\Manager: is_connected: Memoize #39361
Conversation
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available. Follow this PR Review Process:
Still unsure? Reach out in #jetpack-developers for guidance! |
looking |
@sergeymitr is also looking at this. He mentioned the checks are failing cause we're not resetting the state between tests / I tested launching a site from scratch (JN), disconnecting, and reconnecting and it looked fine. |
I believe we should also reset self::$is_connected on site registration and disconnect when we know for sure that the value has changed. |
Ok, got the tests to pass at least. I want to consider these things tomorrow:
|
e6dc371
to
6781af1
Compare
Is there still a benefit after the invalidation added?tldr: yes There is still a benefit. The invalidation does not really run as you are doing casual browsing of the site. However, I refreshed my site with the latest WP and added an object cache client using local memcache. The penalty of running is_connected decreased, but it still looks like a 1-2ms gain. Some requests without the change:
Some requests with the change:
Is there a better way to deal with WorDBless?tldr: no I don't see one, since their options functions are very simple and don't fire hooks. Changing hooks in jetpack options classNot needed. I was able to get everything passing by invalidating off the right |
ad3c94d
to
3ff0b60
Compare
I'm seeing a benefit on logged out homepage loads on a WoA site as well:
I'd like to merge this soon if there are no objections @jeherve @oskosk |
3ff0b60
to
43d61ad
Compare
I was previously using |
…pack_private_options
…nfigure() is not called
6fc41ea
to
ca63743
Compare
Proposed changes:
is_connected()
function, so it's only figured out once per requesta && b
, ifa
is false, we don't need to figure outb
.Reasoning
I noticed it popping up a lot while I reviewed timelines for my local site running JP. I used
ac_start()
andac_stop()
to measure its timing (link) before and after adding memoization.Before
after
Concerns
Other information:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
Testing instructions: