Merge "Safe replacement of a lot of `!count()` with `=== []`"
[lhc/web/wiklou.git] / includes / clientpool / SquidPurgeClientPool.php
index 6dd85e7..3a2a971 100644 (file)
@@ -20,7 +20,7 @@
  * @file
  */
 class SquidPurgeClientPool {
-       /** @var array Array of SquidPurgeClient */
+       /** @var SquidPurgeClient[] */
        protected $clients = [];
 
        /** @var int */
@@ -46,11 +46,9 @@ class SquidPurgeClientPool {
        public function run() {
                $done = false;
                $startTime = microtime( true );
+
                while ( !$done ) {
                        $readSockets = $writeSockets = [];
-                       /**
-                        * @var $client SquidPurgeClient
-                        */
                        foreach ( $this->clients as $clientIndex => $client ) {
                                $sockets = $client->getReadSocketsForSelect();
                                foreach ( $sockets as $i => $socket ) {
@@ -75,6 +73,7 @@ class SquidPurgeClientPool {
                                        socket_strerror( socket_last_error() ) . "\n" );
                                break;
                        }
+
                        // Check for timeout, use 1% tolerance since we aimed at having socket_select()
                        // exit at precisely the overall timeout
                        if ( microtime( true ) - $startTime > $this->timeout * 0.99 ) {
@@ -102,6 +101,7 @@ class SquidPurgeClientPool {
                                }
                        }
                }
+
                foreach ( $this->clients as $client ) {
                        $client->close();
                }