jenkins-bot has submitted this change and it was merged.

Change subject: (bug 48521) Echo should not implicitly commit other transaction
......................................................................


(bug 48521) Echo should not implicitly commit other transaction

Change-Id: I30abd7155b12370aea97218080cc8798f7f0df55
---
M includes/DbEchoBackend.php
1 file changed, 23 insertions(+), 17 deletions(-)

Approvals:
  Aaron Schulz: Looks good to me, approved
  EBernhardson (WMF): Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/includes/DbEchoBackend.php b/includes/DbEchoBackend.php
index 68d9026..b31d314 100644
--- a/includes/DbEchoBackend.php
+++ b/includes/DbEchoBackend.php
@@ -10,24 +10,30 @@
         */
        public function createNotification( $row ) {
                $dbw = MWEchoDbFactory::getDB( DB_MASTER );
-               $dbw->begin( __METHOD__ );
-               // reset the base if this notification has a display hash
-               if ( $row['notification_bundle_display_hash'] ) {
-                       $dbw->update(
-                               'echo_notification',
-                               array( 'notification_bundle_base' => 0 ),
-                               array(
-                                       'notification_user' => 
$row['notification_user'],
-                                       'notification_bundle_display_hash' => 
$row['notification_bundle_display_hash'],
-                                       'notification_bundle_base' => 1
-                               ),
-                               __METHOD__
-                       );
-               }
 
-               $row['notification_timestamp'] = $dbw->timestamp( 
$row['notification_timestamp'] );
-               $dbw->insert( 'echo_notification', $row, __METHOD__ );
-               $dbw->commit( __METHOD__ );
+               $fname = __METHOD__;
+               $dbw->onTransactionIdle(
+                       function() use ( $dbw, $row, $fname ) {
+                               $dbw->begin( $fname );
+                               // reset the base if this notification has a 
display hash
+                               if ( $row['notification_bundle_display_hash'] ) 
{
+                                       $dbw->update(
+                                               'echo_notification',
+                                               array( 
'notification_bundle_base' => 0 ),
+                                               array(
+                                                       'notification_user' => 
$row['notification_user'],
+                                                       
'notification_bundle_display_hash' => $row['notification_bundle_display_hash'],
+                                                       
'notification_bundle_base' => 1
+                                               ),
+                                               $fname
+                                       );
+                               }
+
+                               $row['notification_timestamp'] = 
$dbw->timestamp( $row['notification_timestamp'] );
+                               $dbw->insert( 'echo_notification', $row, $fname 
);
+                               $dbw->commit( $fname );
+                       }
+               );
        }
 
        /**

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I30abd7155b12370aea97218080cc8798f7f0df55
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Bsitu <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: EBernhardson (WMF) <[email protected]>
Gerrit-Reviewer: Kaldari <[email protected]>
Gerrit-Reviewer: Lwelling <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to