Merge "Add MessagesBi.php"
[lhc/web/wiklou.git] / includes / libs / rdbms / ChronologyProtector.php
index 72ca590..938e534 100644 (file)
@@ -44,7 +44,7 @@ class ChronologyProtector implements LoggerAwareInterface {
        /** @var string Hash of client parameters */
        protected $clientId;
        /** @var string[] Map of client information fields for logging */
-       protected $clientInfo;
+       protected $clientLogInfo;
        /** @var int|null Expected minimum index of the last write to the position store */
        protected $waitForPosIndex;
        /** @var int Max seconds to wait on positions to appear */
@@ -66,7 +66,7 @@ class ChronologyProtector implements LoggerAwareInterface {
        /** @var int Seconds to store positions */
        const POSITION_TTL = 60;
        /** @var int Seconds to store position write index cookies (safely less than POSITION_TTL) */
-       const POSITION_COOKIE_TTL = 60;
+       const POSITION_COOKIE_TTL = 10;
        /** @var int Max time to wait for positions to appear */
        const POS_STORE_WAIT_TIMEOUT = 5;
 
@@ -78,13 +78,16 @@ class ChronologyProtector implements LoggerAwareInterface {
         */
        public function __construct( BagOStuff $store, array $client, $posIndex = null ) {
                $this->store = $store;
-               $this->clientId = isset( $client['clientId'] )
-                       ? $client['clientId']
-                       : md5( $client['ip'] . "\n" . $client['agent'] );
+               $this->clientId = $client['clientId'] ??
+                       md5( $client['ip'] . "\n" . $client['agent'] );
                $this->key = $store->makeGlobalKey( __CLASS__, $this->clientId, 'v2' );
                $this->waitForPosIndex = $posIndex;
 
-               $this->clientInfo = $client + [ 'clientId' => '' ];
+               $this->clientLogInfo = [
+                       'clientIP' => $client['ip'],
+                       'clientAgent' => $client['agent'],
+                       'clientId' => $client['clientId'] ?? null
+               ];
 
                $this->logger = new NullLogger();
        }
@@ -313,7 +316,7 @@ class ChronologyProtector implements LoggerAwareInterface {
                                                [
                                                        'cpPosIndex' => $this->waitForPosIndex,
                                                        'waitTimeMs' => $waitedMs
-                                               ] + $this->clientInfo
+                                               ] + $this->clientLogInfo
                                        );
                                } else {
                                        $this->logger->warning(
@@ -322,7 +325,7 @@ class ChronologyProtector implements LoggerAwareInterface {
                                                        'cpPosIndex' => $this->waitForPosIndex,
                                                        'indexReached' => $indexReached,
                                                        'waitTimeMs' => $waitedMs
-                                               ] + $this->clientInfo
+                                               ] + $this->clientLogInfo
                                        );
                                }
                        } else {