78 $type = get_class( $update )
80 $httpMethod =
MW_ENTRY_POINT ===
'cli' ?
'cli' : strtolower( $_SERVER[
'REQUEST_METHOD'] ??
'GET' );
81 $stats = MediaWikiServices::getInstance()->getStatsFactory();
82 $stats->getCounter(
'deferred_updates_total' )
83 ->setLabel(
'http_method', $httpMethod )
84 ->setLabel(
'type', $type )
85 ->copyToStatsdAt(
"deferred_updates.$httpMethod.$type" )
88 $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
89 $ticket = $lbFactory->getEmptyTransactionTicket( __METHOD__ );
90 if ( !$ticket || $lbFactory->hasTransactionRound() ) {
95 $update->setTransactionTicket( $ticket );
99 $fnameTrxOwner = ( $update instanceof DeferrableCallback )
100 ? $update->getOrigin()
101 : get_class( $update ) .
'::doUpdate';
104 $useExplicitTrxRound = !(
105 $update instanceof TransactionRoundAwareUpdate &&
106 $update->getTransactionRoundRequirement() == $update::TRX_ROUND_ABSENT
108 if ( $useExplicitTrxRound ) {
110 $lbFactory->beginPrimaryChanges( $fnameTrxOwner );
113 $lbFactory->commitPrimaryChanges( $fnameTrxOwner );