From: Aaron Schulz Date: Wed, 14 Sep 2016 06:52:05 +0000 (-0700) Subject: Set cpPosTime cookie for the non-redirect case as well X-Git-Tag: 1.31.0-rc.0~5593 X-Git-Url: http://git.cyclocoop.org/%27%20%20%20rItem.link%20%20%20%27?a=commitdiff_plain;h=a3814f52c4ef292eda1c3bf8e8aa2ac61e9b6e5d;p=lhc%2Fweb%2Fwiklou.git Set cpPosTime cookie for the non-redirect case as well This is useful if the ChronologyProtector store cannot sync among datacenters and waitForReplication() is DC-local. It only applies if the user stays on the domain, however. Change-Id: I800cade7b87a0f02d6a429e70924c54189a4a7af --- diff --git a/includes/MediaWiki.php b/includes/MediaWiki.php index 5ea8c31b15..9bbbd352b4 100644 --- a/includes/MediaWiki.php +++ b/includes/MediaWiki.php @@ -604,6 +604,14 @@ class MediaWiki { // OutputPage::output() is fairly slow; run it in $postCommitWork to mask // the latency of syncing DB positions accross all datacenters synchronously $flags = $lbFactory::SHUTDOWN_CHRONPROT_SYNC; + if ( $lbFactory->hasOrMadeRecentMasterChanges( INF ) ) { + $cpPosTime = microtime( true ); + // Set a cookie in case the DB position store cannot sync accross datacenters. + // This will at least cover the common case of the user staying on the domain. + $expires = time() + ChronologyProtector::POSITION_TTL; + $options = [ 'prefix' => '' ]; + $request->response()->setCookie( 'cpPosTime', $cpPosTime, $expires, $options ); + } } // Record ChronologyProtector positions for DBs affected in this request at this point $lbFactory->shutdown( $flags, $postCommitWork );