Merge "Remove self-explaining "section heading" comments from classes"
[lhc/web/wiklou.git] / includes / objectcache / ObjectCache.php
index 3370e5b..67d2346 100644 (file)
@@ -332,7 +332,11 @@ class ObjectCache {
         * @throws UnexpectedValueException
         */
        public static function newWANCacheFromParams( array $params ) {
-               $erGroup = MediaWikiServices::getInstance()->getEventRelayerGroup();
+               global $wgCommandLineMode;
+
+               $services = MediaWikiServices::getInstance();
+
+               $erGroup = $services->getEventRelayerGroup();
                foreach ( $params['channels'] as $action => $channel ) {
                        $params['relayers'][$action] = $erGroup->getRelayer( $channel );
                        $params['channels'][$action] = $channel;
@@ -343,6 +347,12 @@ class ObjectCache {
                } else {
                        $params['logger'] = LoggerFactory::getInstance( 'objectcache' );
                }
+               if ( !$wgCommandLineMode ) {
+                       // Send the statsd data post-send on HTTP requests; avoid in CLI mode (T181385)
+                       $params['stats'] = $services->getStatsdDataFactory();
+                       // Let pre-emptive refreshes happen post-send on HTTP requests
+                       $params['asyncHandler'] = [ DeferredUpdates::class, 'addCallableUpdate' ];
+               }
                $class = $params['class'];
 
                return new $class( $params );