Use getConnectionRef() in ExternalStoreDB to avoid connection leaks
authorAaron Schulz <aschulz@wikimedia.org>
Wed, 21 Sep 2016 07:58:14 +0000 (00:58 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Wed, 21 Sep 2016 08:01:00 +0000 (08:01 +0000)
Change-Id: I3df270241653841a4fb2f65e240aae9d2e0b650f

includes/externalstore/ExternalStoreDB.php

index 2eae279..7e93299 100644 (file)
@@ -130,7 +130,7 @@ class ExternalStoreDB extends ExternalStoreMedium {
                        wfDebug( "writable external store\n" );
                }
 
-               $db = $lb->getConnection( DB_REPLICA, [], $wiki );
+               $db = $lb->getConnectionRef( DB_REPLICA, [], $wiki );
                $db->clearFlag( DBO_TRX ); // sanity
 
                return $db;
@@ -146,7 +146,7 @@ class ExternalStoreDB extends ExternalStoreMedium {
                $wiki = isset( $this->params['wiki'] ) ? $this->params['wiki'] : false;
                $lb = $this->getLoadBalancer( $cluster );
 
-               $db = $lb->getConnection( DB_MASTER, [], $wiki );
+               $db = $lb->getConnectionRef( DB_MASTER, [], $wiki );
                $db->clearFlag( DBO_TRX ); // sanity
 
                return $db;