fb-instant-articles icon indicating copy to clipboard operation
fb-instant-articles copied to clipboard

Bug - Transients created in autoload=true, on table wp_options

Open algmelo opened this issue 7 years ago • 7 comments

Steps required to reproduce the problem

  1. Insert a embed on post content (Youtube, Facebook, Twitter or Instagram)
  2. Access this post
  3. Verify MySQL table wp_options, and run this query:

SELECT option_name, option_value FROM wp_options WHERE autoload = 'yes'

  1. See the result, and you'll find something like this:

option_name option_value _transient_c80eac53c8183dd70511050453ff1b33 youtube _transient_c80eac53c89340d9dfd49d8gddf42d94 twitter

Expected Result

The expected result is that this item is without autoload = true, which is overloading the mysql response, which needs to return a huge amount of completely unnecessary information.

Version Info

Please state exact versions, not latest or new.

  • Plugin version: 4.0.6
  • WordPress version: 4.9.4
  • PHP version: 5.5.9

Without the above information we are not able to debug the issue and will close it.

algmelo avatar Mar 10 '18 20:03 algmelo

No news on this bug?

algmelo avatar Jun 11 '18 14:06 algmelo

@algmelo Not sure I fully understood the problem you are raising here. Are you affirming that the autoload = true is being set by this plugin?

everton-rosario avatar Jun 11 '18 17:06 everton-rosario

Exact, @everton-rosario !

Before opening the issue, I did the test:

  • I disabled all the plugins that were in my Wordpress installation
  • I removed all entries that had 'transient' in option_name and autoload = true
  • I accessed the url /feed/instant-articles/

When you run the above query (SELECT option_name, option_value FROM wp_options WHERE autoload = 'yes') in MySQL, entries with autoload = true have been re-created.

The problem is that as I have an installation with a large database (over 1.5Gb), and with large traffic (more than 8mil simultaneous accesses).

One of the slowest queries is the one I mentioned.

algmelo avatar Jun 11 '18 18:06 algmelo

Gotcha. I could find the lines you should try change:

File embeds.php

	if ( $provider_name ) {
		$html = instant_articles_embed_get_html( $provider_name, $html, $url, $attr, $post_id );
		delete_transient( $cache_key );   // Add this line right after the get_html
	}

Didn't test, but it looks promising. Check if this will fix the issue for you.

everton-rosario avatar Jun 11 '18 19:06 everton-rosario

Great, @everton-rosario !!!

This solved the problem, but how to do in case of future updates in the plugin?

Thanks!

algmelo avatar Jun 12 '18 16:06 algmelo

Can you send a PR with that fix? We need to double check for further impact into the code (if this will generate any unwanted collateral behavior).

everton-rosario avatar Jun 12 '18 17:06 everton-rosario

Hi, @everton-rosario

I created a PR with the fix. I had never done a PR haha

I hope the amendment is accepted.

Thanks for the guidance!

algmelo avatar Jul 03 '18 18:07 algmelo

This issue has been marked stale because it has been open for 30 days with no activity. If there is no activity within 7 days, it will be closed. This is an automation to keep issues manageable and actionable and is not a comment on the quality of this issue nor on the work done so far. Closed issues are still valuable to the project and are available to be searched.

github-actions[bot] avatar Oct 19 '22 00:10 github-actions[bot]

The PR was merged and released in 4.1.1.

GaryJones avatar Oct 19 '22 09:10 GaryJones