X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fdeferred%2FLinksUpdate.php;h=dbe387be732b7105d241f038266815d620f89f70;hp=5b1be6d2a59f5ec9592c889894a56334839b166f;hb=74d04edec385aa86ee01943b9a27475d79f74e78;hpb=40d3ce8d177d927e2e0d98500e8196e7bae069d2 diff --git a/includes/deferred/LinksUpdate.php b/includes/deferred/LinksUpdate.php index 5b1be6d2a5..dbe387be73 100644 --- a/includes/deferred/LinksUpdate.php +++ b/includes/deferred/LinksUpdate.php @@ -21,6 +21,7 @@ */ use Wikimedia\Rdbms\IDatabase; +use MediaWiki\Logger\LoggerFactory; use MediaWiki\MediaWikiServices; use Wikimedia\ScopedCallback; @@ -163,6 +164,9 @@ class LinksUpdate extends DataUpdate implements EnqueueableDataUpdate { // Make sure all links update threads see the changes of each other. // This handles the case when updates have to batched into several COMMITs. $scopedLock = self::acquirePageLock( $this->getDB(), $this->mId ); + if ( !$scopedLock ) { + throw new RuntimeException( "Could not acquire lock for page ID '{$this->mId}'." ); + } } // Avoid PHP 7.1 warning from passing $this by reference @@ -190,15 +194,19 @@ class LinksUpdate extends DataUpdate implements EnqueueableDataUpdate { * @param IDatabase $dbw * @param int $pageId * @param string $why One of (job, atomicity) - * @return ScopedCallback - * @throws RuntimeException + * @return ScopedCallback|null * @since 1.27 */ public static function acquirePageLock( IDatabase $dbw, $pageId, $why = 'atomicity' ) { $key = "LinksUpdate:$why:pageid:$pageId"; $scopedLock = $dbw->getScopedLockAndFlush( $key, __METHOD__, 15 ); if ( !$scopedLock ) { - throw new RuntimeException( "Could not acquire lock '$key'." ); + $logger = LoggerFactory::getInstance( 'SecondaryDataUpdate' ); + $logger->info( "Could not acquire lock '{key}' for page ID '{page_id}'.", [ + 'key' => $key, + 'page_id' => $pageId, + ] ); + return null; } return $scopedLock;