[wp-trac] [WordPress Trac] #5932: wpdb should reconnect and retry query when "MySQL server has gone away"

WordPress Trac wp-trac at lists.automattic.com
Tue Aug 7 20:47:18 UTC 2012


#5932: wpdb should reconnect and retry query when "MySQL server has gone away"
--------------------------+-----------------------------
 Reporter:  dtc           |       Owner:  anonymous
     Type:  defect (bug)  |      Status:  reopened
 Priority:  normal        |   Milestone:  Future Release
Component:  Database      |     Version:  3.0
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |
--------------------------+-----------------------------
Changes (by pento):

 * keywords:  reporter-feedback => has-patch


Comment:

 This patch checks the connection whenever `wpdb::query()` is run. This
 will add a slight delay to each query (approximately the ping time to the
 MySQL server).

 Here's a testing snippet.

 {{{
 global $wpdb;
 $wpdb->query( 'SET SESSION wait_timeout = 10;' );
 echo $wpdb->get_var( 'select id from wp_posts limit 1;' );
 sleep( 12 );
 echo $wpdb->get_var( 'select id from wp_posts limit 1,1;' );

 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/5932#comment:10>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list