Migrate PurgeJobUtils callback to AutoCommitUpdate
authorAaron Schulz <aschulz@wikimedia.org>
Tue, 17 Apr 2018 00:11:42 +0000 (17:11 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Tue, 17 Apr 2018 00:11:48 +0000 (17:11 -0700)
Since it calls LBFactory::commitAndWaitForReplication, blocking for
an unknown amount of time, it is a bit "heavyweight" to be the sort
of quick update that uses onTransactionIdle().

Change-Id: Ic3476de5b61a7cd5f31ba487b186f9605a3b2774

includes/jobqueue/utils/PurgeJobUtils.php

index ba80c8e..5d8a6cf 100644 (file)
@@ -37,7 +37,9 @@ class PurgeJobUtils {
                        return;
                }
 
-               $dbw->onTransactionIdle(
+               DeferredUpdates::addUpdate( new AutoCommitUpdate(
+                       $dbw,
+                       __METHOD__,
                        function () use ( $dbw, $namespace, $dbkeys ) {
                                $services = MediaWikiServices::getInstance();
                                $lbFactory = $services->getDBLoadBalancerFactory();
@@ -74,8 +76,7 @@ class PurgeJobUtils {
                                        );
                                        $lbFactory->commitAndWaitForReplication( __METHOD__, $ticket );
                                }
-                       },
-                       __METHOD__
-               );
+                       }
+               ) );
        }
 }