Demon has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/62432


Change subject: Move DEADLOCK_* constants into DatabaseBase
......................................................................

Move DEADLOCK_* constants into DatabaseBase

Change-Id: I75ea4c19c757adc96ba3c5afe0b85d8579b02c80
---
M includes/db/Database.php
1 file changed, 8 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/32/62432/1

diff --git a/includes/db/Database.php b/includes/db/Database.php
index 1cbffd8..9a239ae 100644
--- a/includes/db/Database.php
+++ b/includes/db/Database.php
@@ -24,13 +24,6 @@
  * @ingroup Database
  */
 
-/** Number of times to re-try an operation in case of deadlock */
-define( 'DEADLOCK_TRIES', 4 );
-/** Minimum time to wait before retry, in microseconds */
-define( 'DEADLOCK_DELAY_MIN', 500000 );
-/** Maximum time to wait before retry */
-define( 'DEADLOCK_DELAY_MAX', 1500000 );
-
 /**
  * Base interface for all DBMS-specific code. At a bare minimum, all of the
  * following must be implemented to support MediaWiki
@@ -216,6 +209,12 @@
  * @ingroup Database
  */
 abstract class DatabaseBase implements DatabaseType {
+       /** Number of times to re-try an operation in case of deadlock */
+       const DEADLOCK_TRIES = 4;
+       /** Minimum time to wait before retry, in microseconds */
+       const DEADLOCK_DELAY_MIN = 500000;
+       /** Maximum time to wait before retry */
+       const DEADLOCK_DELAY_MAX = 1500000;
 
 # 
------------------------------------------------------------------------------
 # Variables
@@ -2860,7 +2859,7 @@
                $args = func_get_args();
                $function = array_shift( $args );
                $oldIgnore = $this->ignoreErrors( true );
-               $tries = DEADLOCK_TRIES;
+               $tries = self::DEADLOCK_TRIES;
 
                if ( is_array( $function ) ) {
                        $fname = $function[0];
@@ -2877,7 +2876,7 @@
                        if ( $errno ) {
                                if ( $this->wasDeadlock() ) {
                                        # Retry
-                                       usleep( mt_rand( DEADLOCK_DELAY_MIN, 
DEADLOCK_DELAY_MAX ) );
+                                       usleep( mt_rand( 
self::DEADLOCK_DELAY_MIN, self::DEADLOCK_DELAY_MAX ) );
                                } else {
                                        $this->reportQueryError( $error, 
$errno, $sql, $fname );
                                }

-- 
To view, visit https://gerrit.wikimedia.org/r/62432
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I75ea4c19c757adc96ba3c5afe0b85d8579b02c80
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Demon <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to