Support » Plugin: Woo Custom Emails Per Product » HTTP 502 Error when attempting to view Assigned Messages

  • When trying out the new feature Assigned Messages in 2.2.6, I get a 502 (timed out) error message. Running WP 5.5.3 and WooCommerce 4.7.1. I have two messages, each assigned to one product each. Thoughts?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author alexmustin

    (@alexmustin)

    Hi @sdowney2002 ,

    Thanks for using my plugin!

    Sorry to hear that you’re having problems, especially with only 2 Custom Messages.

    This must be the wp_query causing the server to timeout.
    The query can have issues if you have a lot of products on your site…

    Can you try replacing the code around Line 200 of the file /woocustomemails/admin/class-woo-custom-emails-per-product-admin-settings.php with the following:

    $args = array(
    	'post_type'            => 'product',
    	'no_found_rows'        => true,
    	'meta_query'           => array(
    		'relation' => 'OR',
    		array(
    			'key' => 'wcemessage_id_onhold',
    			'value' => '',
    			'compare' => '!=',
    		),
    		array(
    			'key' => 'wcemessage_id_processing',
    			'value' => '',
    			'compare' => '!=',
    		),
    		array(
    			'key' => 'wcemessage_id_completed',
    			'value' => '',
    			'compare' => '!=',
    		),
    	),
    );

    Please let me know the outcome after you’ve updated the query.

    Thanks in advance!

    Thread Starter Steve D.

    (@sdowney2002)

    Alex,

    Thanks for the quick reply.

    I’ve made the code change as requested. I’ve also turned off all other plugins, and switched to the default Storefront theme. I’ve removed both existing custom messages from their products and deleted both existing custom messages. I’ve created one new custom message and added it to one new product.

    When I now go to Custom Emails > Assigned Messages, it takes about 2 minutes for the page to load and it reports that I have zero products with WCE messages.

    My error log throws this message:

    WordPress database error MySQL server has gone away for query SELECT wp_posts.ID FROM wp_posts INNER JOIN wp_postmeta ON ( wp_posts.ID = wp_postmeta.post_id ) INNER JOIN wp_postmeta AS mt1 ON ( wp_posts.ID = mt1.post_id ) INNER JOIN wp_postmeta AS mt2 ON ( wp_posts.ID = mt2.post_id ) WHERE 1=1 AND ( \n ( wp_postmeta.meta_key = ‘wcemessage_id_onhold’ AND wp_postmeta.meta_value != ” ) \n OR \n ( mt1.meta_key = ‘wcemessage_id_processing’ AND mt1.meta_value != ” ) \n OR \n ( mt2.meta_key = ‘wcemessage_id_completed’ AND mt2.meta_value != ” )\n) AND wp_posts.post_type = ‘product’ AND (wp_posts.post_status = ‘publish’ OR wp_posts.post_status = ‘future’ OR wp_posts.post_status = ‘draft’ OR wp_posts.post_status = ‘pending’ OR wp_posts.post_status = ‘private’) GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 10 /* From [*******/wp-admin/edit.php?post_type=woocustomemails&page=woocustomemails_assigned] in [/*****/wp-content/plugins/woo-custom-emails-per-product/admin/class-woo-custom-emails-per-product-admin-settings.php:227] */ made by require_once(‘wp-admin/admin.php’), do_action(‘woocustomemails_page_woocustomemails_assigned’), WP_Hook->do_action, WP_Hook->apply_filters, Woo_Custom_Emails_Per_Product_Admin_Settings->display_wce_assigned_page, WP_Query->__construct, WP_Query->query, WP_Query->get_posts, referer: https://*******.com/wp-admin/edit.php?post_type=woocustomemails&page=woocustomemails_settings_page

    Hi
    I get the same, 503 service unavailable, I’ve just tried the update from a few hours ago, and it’s still the same.
    In cPanel the statistics show, Number Of Processes
    30 / 30 (100%).
    This starts when I go to Assigned messages, just the same.
    I hope you can help.
    Thanks

    Thread Starter Steve D.

    (@sdowney2002)

    Hey Alex, just wondering if there’s been any progress on this issue. (I’ve upgraded to 2.2.7 and the issue remains.)

    Thanks!

    Steve

    Also getting exactly the same issue, have not been able to access the Assigned Messages settings at all.

    Plugin Author alexmustin

    (@alexmustin)

    Hey @nickpastor @sdowney2002 @richard-b

    Thanks for checking in.

    The issue is because of the query I’m using — it will search through _all_ Woo products and look for Custom Email Messages assigned, which is saved as meta data — but I just found out doing queries like this is extremely slow and causes the error; it’s difficult to find these things when you only have a local dev environment to develop and test on.

    I will need to change how this feature works entirely in order for it to be reliable.

    I have a couple questions to help me troubleshoot:
    – How many Woo Products do you have on your site?
    – How many Custom Email Messages have you created?

    Thanks in advance!

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.