The hook handlers are likely to write to secondary databases, in which
case it is better to wrap the callback in its own transaction round.
This lowers the chance of pending write warnings happening in
runMasterTransactionIdleCallbacks() as well as DBTransactionError
exceptions in LBFactory due to recursion during commit.
Bug: T191282
Bug: T193668
Change-Id: Ie207ca312888b6bb076f783d41f05b701f70a52e
// Commit and release the lock (if set)
ScopedCallback::consume( $scopedLock );
- // Run post-commit hooks without DBO_TRX
- $this->getDB()->onTransactionIdle(
+ // Run post-commit hook handlers without DBO_TRX
+ DeferredUpdates::addUpdate( new AutoCommitUpdate(
+ $this->getDB(),
+ __METHOD__,
function () {
// Avoid PHP 7.1 warning from passing $this by reference
$linksUpdate = $this;
Hooks::run( 'LinksUpdateComplete', [ &$linksUpdate, $this->ticket ] );
- },
- __METHOD__
- );
+ }
+ ) );
}
/**