You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
IF YOU DO NOT FOLLOW THIS TEMPLATE, YOUR ISSUE MAY BE CLOSED!!
Please provide the following information when creating your issues:
Site Info
WordPress Version: 6.6.2
QSM Version: 9.1.3
Browser: all
General description
When QMN_Log_Manager::insert_log() writes items to the posts table, it can dramatically slow down the site. I saw this specifically in the context of a failed database update (which I'll describe in a separate ticket). The plugin was trying to log the failure to run the utf8mb4 conversions introduced in 9.0.1:
without passing a post_name, WP used wp_unique_post_slug() to build a slug based on the post title. But it had to try hundreds of different numerical suffixes before finding a unique one.
Expected behavior
One of two things:
Don't insert hundreds of duplicate log entries. In some cases, dupes are helpful. But for an upgrade routine that loads on every 'admin_init' and tries to run the same database upgrade routine, I'd suggest that the duplicates are not useful.
Pass a known-unique slug to wp_insert_post(). Something like 'qsm-log-entry-' . time() would be enough to avoid the costly lookups.
Actual behavior
Many queries are performed
Steps to reproduce the behavior
Insert a bunch of identical log entries, then monitor SQL queries
The text was updated successfully, but these errors were encountered:
IF YOU DO NOT FOLLOW THIS TEMPLATE, YOUR ISSUE MAY BE CLOSED!!
Please provide the following information when creating your issues:
Site Info
WordPress Version: 6.6.2
QSM Version: 9.1.3
Browser: all
General description
When
QMN_Log_Manager::insert_log()
writes items to the posts table, it can dramatically slow down the site. I saw this specifically in the context of a failed database update (which I'll describe in a separate ticket). The plugin was trying to log the failure to run the utf8mb4 conversions introduced in 9.0.1:quiz_master_next/php/admin/functions.php
Line 252 in 103b318
But the upgrade had failed a number of times before, meaning that there were already hundreds of identical log entries. When calling
wp_insert_post()
quiz_master_next/php/classes/class-qmn-log-manager.php
Line 117 in 103b318
post_name
, WP usedwp_unique_post_slug()
to build a slug based on the post title. But it had to try hundreds of different numerical suffixes before finding a unique one.Expected behavior
One of two things:
wp_insert_post()
. Something like'qsm-log-entry-' . time()
would be enough to avoid the costly lookups.Actual behavior
Many queries are performed
Steps to reproduce the behavior
Insert a bunch of identical log entries, then monitor SQL queries
The text was updated successfully, but these errors were encountered: