From: Aaron Schulz Date: Tue, 21 Nov 2017 02:58:05 +0000 (-0800) Subject: Avoid blocking locks during API edit stash generation X-Git-Tag: 1.31.0-rc.0~1421^2 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=6fb6fc9dc2170c75b35ede414d4049b6925b177a Avoid blocking locks during API edit stash generation Bug: T180793 Change-Id: Ibc29a20329113c3ee54fd48cfe86ca8251e8098d --- diff --git a/includes/api/ApiStashEdit.php b/includes/api/ApiStashEdit.php index 4bd6a3fb6f..b4b9321787 100644 --- a/includes/api/ApiStashEdit.php +++ b/includes/api/ApiStashEdit.php @@ -181,9 +181,14 @@ class ApiStashEdit extends ApiBase { $title = $page->getTitle(); $key = self::getStashKey( $title, self::getContentHash( $content ), $user ); - // Use the master DB for fast blocking locks + // Use the master DB to allow for fast blocking locks on the "save path" where this + // value might actually be used to complete a page edit. If the edit submission request + // happens before this edit stash requests finishes, then the submission will block until + // the stash request finishes parsing. For the lock acquisition below, there is not much + // need to duplicate parsing of the same content/user/summary bundle, so try to avoid + // blocking at all here. $dbw = wfGetDB( DB_MASTER ); - if ( !$dbw->lock( $key, __METHOD__, 1 ) ) { + if ( !$dbw->lock( $key, __METHOD__, 0 ) ) { // De-duplicate requests on the same key return self::ERROR_BUSY; }