[Libreoffice-commits] online.git: loolwsd/test

Ashod Nakashian ashod.nakashian at collabora.co.uk
Mon Oct 10 06:27:19 UTC 2016


 loolwsd/test/countloolkits.hpp |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

New commits:
commit d7799d21a888fe0c0325531e43feb9d613739f31
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sat Oct 8 21:40:52 2016 -0400

    loolwsd: cleanup of LoolKit process counter
    
    Change-Id: I7d8bec2634b1c838cd10a8bef928ea22c2d2f549
    Reviewed-on: https://gerrit.libreoffice.org/29643
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/test/countloolkits.hpp b/loolwsd/test/countloolkits.hpp
index d0c479c..b96e173 100644
--- a/loolwsd/test/countloolkits.hpp
+++ b/loolwsd/test/countloolkits.hpp
@@ -61,30 +61,33 @@ int getLoolKitProcessCount()
         }
     }
 
-    std::cerr << "Number of loolkit processes: " << result << std::endl;
     return result;
 }
 
 static
 int countLoolKitProcesses(const int expected)
 {
-    // Fairly random number, I don't think there is any actual reason for using exactly this repeat
-    // count.
-    const size_t repeat = 21;
+    std::cerr << "Waiting to have " << expected << " loolkit processes. Loolkits: ";
+
+    // Retry for about 3 seconds.
+    const auto sleepMs = static_cast<int>(POLL_TIMEOUT_MS / 3);
+    const size_t repeat = (3000 / sleepMs) + 1;
     auto count = getLoolKitProcessCount();
     for (size_t i = 0; i < repeat; ++i)
     {
+        std::cerr << count << ' ';
         if (count == expected)
         {
-            return count;
+            break;
         }
 
         // Give polls in the lool processes time to time out etc
-        Poco::Thread::sleep(POLL_TIMEOUT_MS / 2);
+        Poco::Thread::sleep(sleepMs);
 
         count = getLoolKitProcessCount();
     }
 
+    std::cerr << std::endl;
     if (expected != count)
     {
         std::cerr << "Found " << count << " LoKit processes but was expecting " << expected << "." << std::endl;


More information about the Libreoffice-commits mailing list